📄 xgrabbutton.html
字号:
<HTML><HEAD><TITLE>Xlib Programming Manual: XGrabButton</TITLE></HEAD><BODY><H1 ALIGN=center>XGrabButton</H1><H2>Syntax</H2><!.IN "Grabbing" "buttons"><!.IN "Button" "grabbing"><!.IN "XGrabButton" "" "@DEF@"><CODE><PRE>XGrabButton(<B>display</B>, <B>button</B>, <B>modifiers</B>, <B>grab_window</B>, <B>owner_events</B>, <B>event_mask</B>, <B>pointer_mode</B>, <B>keyboard_mode</B>, <B>confine_to</B>, <B>cursor</B>) <A HREF="../display/opening.html#Display">Display</A> *<B>display</B>; unsigned int <B>button</B>; unsigned int <B>modifiers</B>; Window <B>grab_window</B>; Bool <B>owner_events</B>; unsigned int <B>event_mask</B>; int <B>pointer_mode</B>, <B>keyboard_mode</B>; Window <B>confine_to</B>; Cursor <B>cursor</B>; </PRE></CODE><H2>Arguments</H2><TABLE><TR><TD> <B>display</B><TD> Specifies the connection to the X server.<TR><TD> <B>button</B><TD> Specifies the pointer button that is to be grabbed or<B>AnyButton</B>.<TR><TD> <B>modifiers</B><TD> Specifies the set of keymasks or<B>AnyModifier</B>.The mask is the bitwise inclusive OR of the valid keymask bits.<TR><TD> <B>grab_window</B><TD> Specifies the grab window.<TR><TD> <B>owner_events</B><TD> Specifies a Boolean value that indicates whether the pointer events are to be reported as usual or reported with respect to the grab window if selected by the event mask.<TR><TD> <B>event_mask</B><TD> Specifies which pointer events are reported to the client.The mask is the bitwise inclusive OR of the valid pointer event mask bits.<TR><TD> <B>pointer_mode</B><TD> Specifies further processing of pointer events.You can pass <B>GrabModeSync</B> or<B>GrabModeAsync</B>.<TR><TD> <B>keyboard_mode</B><TD> Specifies further processing of keyboard events.You can pass <B>GrabModeSync</B> or<B>GrabModeAsync</B>.<TR><TD> <B>confine_to</B><TD> Specifies the window to confine the pointer in or<B>None</B>.<TR><TD> <B>cursor</B><TD> Specifies the cursor that is to be displayed or<B>None</B>.</TABLE><H2>Description</H2>The<B>XGrabButton()</B>function establishes a passive grab.In the future,the pointer is actively grabbed (as for<B><A HREF="XGrabPointer.html">XGrabPointer()</A></B>),the last-pointer-grab time is set to the time at which the button was pressed(as transmitted in the<B><A HREF="../events/keyboard-pointer/keyboard-pointer.html">ButtonPress</A></B>event), and the<B><A HREF="../events/keyboard-pointer/keyboard-pointer.html">ButtonPress</A></B>event is reported if all of the following conditions are true:<UL><P><LI>The pointer is not grabbed, and the specified button is logically pressedwhen the specified modifier keys are logically down,and no other buttons or modifier keys are logically down.<P><LI>The grab_window contains the pointer.<P><LI>The confine_to window (if any) is viewable.<P><LI>A passive grab on the same button/key combination does not existon any ancestor of grab_window.</UL><P>The interpretation of the remaining arguments is as for<B><A HREF="XGrabPointer.html">XGrabPointer()</A></B>.The active grab is terminated automatically when the logical state of thepointer has all buttons released(independent of the state of the logical modifier keys).<P>Note that the logical state of a device (as seen by client applications)may lag the physical state if device event processing is frozen.<P>This request overrides all previous grabs by the same client on the samebutton/key combinations on the same window.A modifiers of <B>AnyModifier</B>is equivalent to issuing the grab request for allpossible modifier combinations (including the combination of no modifiers). It is not required that all modifiers specified have currently assigned KeyCodes.A button of <B>AnyButton</B>is equivalent toissuing the request for all possible buttons.Otherwise, it is not required that the specified button currently be assignedto a physical button.<P>If some other client has already issued a <B>XGrabButton()</B>with the same button/key combination on the same window, a<B>BadAccess</B>error results.When using <B>AnyModifier</B>or <B>AnyButton</B>, the request fails completely,and a<B>BadAccess</B>error results (no grabs areestablished) if there is a conflicting grab for any combination.<B>XGrabButton()</B>has no effect on an active grab.<P><B>XGrabButton()</B>can generate<B>BadCursor</B>,<B>BadValue</B>,and<B>BadWindow</B> errors.<H2>Diagnostics</H2><TABLE><TR><TD><B>BadCursor</B> <TD>A value for a Cursor argument does not name a defined Cursor.<TR><TD><B>BadValue</B><TD> Some numeric value falls outside the range of values accepted by the request. Unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. Any argument defined as a set of alternatives can generate this error.<TR><TD><B>BadWindow</B><TD>A value for a Window argument does not name a defined Window.</TABLE><H2>See also</H2><B><A HREF="XAllowEvents.html">XAllowEvents()</A></B>,<B><A HREF="XChangeActivePointerGrab.html">XChangeActivePointerGrab()</A></B>,<B><A HREF="XGrabKey.html">XGrabKey()</A></B>,<B><A HREF="XGrabKeyboard.html">XGrabKeyboard()</A></B>,<B><A HREF="XGrabPointer.html">XGrabPointer()</A></B>,<B><A HREF="XUngrabPointer.html">XUngrabPointer()</A></B>,"<A HREF="pointer-grabbing.html">Pointer Grabbing</A>".<HR><ADDRESS><A HREF="http://tronche.com/">Christophe Tronche</A>, <A HREF="mailto:ch.tronche@computer.org">ch.tronche@computer.org</A></ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -