📄 gdk-general.html
字号:
<p>Flushes the X output buffer and waits until all requests have been processedby the server. This is rarely needed by applications. It's main use is fortrapping X errors with <a class="link" href="gdk-General.html#gdk-error-trap-push"><code class="function">gdk_error_trap_push()</code></a> and <a class="link" href="gdk-General.html#gdk-error-trap-pop"><code class="function">gdk_error_trap_pop()</code></a>.</p></div><hr><div class="refsect2" lang="en"><a name="id3046507"></a><h3><a name="gdk-screen-width"></a>gdk_screen_width ()</h3><a class="indexterm" name="id3046517"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> gdk_screen_width (void);</pre><p>Returns the width of the default screen in pixels.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the width of the default screen in pixels.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3046555"></a><h3><a name="gdk-screen-height"></a>gdk_screen_height ()</h3><a class="indexterm" name="id3046565"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> gdk_screen_height (void);</pre><p>Returns the height of the default screen in pixels.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the height of the default screen in pixels.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3046603"></a><h3><a name="gdk-screen-width-mm"></a>gdk_screen_width_mm ()</h3><a class="indexterm" name="id3046613"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> gdk_screen_width_mm (void);</pre><p>Returns the width of the default screen in millimeters.Note that on many X servers this value will not be correct.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the width of the default screen in millimeters,though it is not always correct.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3046653"></a><h3><a name="gdk-screen-height-mm"></a>gdk_screen_height_mm ()</h3><a class="indexterm" name="id3046663"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint">gint</a> gdk_screen_height_mm (void);</pre><p>Returns the height of the default screen in millimeters.Note that on many X servers this value will not be correct.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the height of the default screen in millimeters,though it is not always correct.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3046702"></a><h3><a name="gdk-pointer-grab"></a>gdk_pointer_grab ()</h3><a class="indexterm" name="id3046713"></a><pre class="programlisting"><a class="link" href="gdk-General.html#GdkGrabStatus">GdkGrabStatus</a> gdk_pointer_grab (<a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> *window, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> owner_events, <a class="link" href="gdk-Events.html#GdkEventMask">GdkEventMask</a> event_mask, <a class="link" href="gdk-Windows.html#GdkWindow">GdkWindow</a> *confine_to, <a class="link" href="gdk-Cursors.html#GdkCursor">GdkCursor</a> *cursor, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);</pre><p>Grabs the pointer (usually a mouse) so that all events are passed to thisapplication until the pointer is ungrabbed with <a class="link" href="gdk-General.html#gdk-pointer-ungrab"><code class="function">gdk_pointer_ungrab()</code></a>, orthe grab window becomes unviewable.This overrides any previous pointer grab by this client.</p><p>Pointer grabs are used for operations which need complete control over mouseevents, even if the mouse leaves the application.For example in GTK+ it is used for Drag and Drop, for dragging the handle inthe <ahref="/usr/share/gtk-doc/html/gtk/GtkHPaned.html"><span class="type">GtkHPaned</span></a> and <ahref="/usr/share/gtk-doc/html/gtk/GtkVPaned.html"><span class="type">GtkVPaned</span></a> widgets, and for resizing columns in <ahref="/usr/share/gtk-doc/html/gtk/GtkCList.html"><span class="type">GtkCList</span></a>widgets.</p><p>Note that if the event mask of an X window has selected both button press andbutton release events, then a button press event will cause an automaticpointer grab until the button is released.X does this automatically since most applications expect to receive buttonpress and release events in pairs.It is equivalent to a pointer grab on the window with <em class="parameter"><code>owner_events</code></em> set to<ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.</p><p>If you set up anything at the time you take the grab that needs to be cleanedup when the grab ends, you should handle the <a class="link" href="gdk-Event-Structures.html#GdkEventGrabBroken"><span class="type">GdkEventGrabBroken</span></a> events thatare emitted when the grab ends unvoluntarily.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>window</code></em> :</span></p></td><td>the <a class="link" href="gdk-Windows.html#GdkWindow"><span class="type">GdkWindow</span></a> which will own the grab (the grab window).</td></tr><tr><td><p><span class="term"><em class="parameter"><code>owner_events</code></em> :</span></p></td><td>if <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> then all pointer events are reported with respect to<em class="parameter"><code>window</code></em> and are only reported if selected by <em class="parameter"><code>event_mask</code></em>. If <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> then pointerevents for this application are reported as normal, but pointer events outsidethis application are reported with respect to <em class="parameter"><code>window</code></em> and only if selected by<em class="parameter"><code>event_mask</code></em>. In either mode, unreported events are discarded.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>event_mask</code></em> :</span></p></td><td>specifies the event mask, which is used in accordance with<em class="parameter"><code>owner_events</code></em>. Note that only pointer events (i.e. button and motion events) may be selected.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>confine_to</code></em> :</span></p></td><td>If non-<ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>, the pointer will be confined to thiswindow during the grab. If the pointer is outside <em class="parameter"><code>confine_to</code></em>, it willautomatically be moved to the closest edge of <em class="parameter"><code>confine_to</code></em> and enterand leave events will be generated as necessary.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>cursor</code></em> :</span></p></td><td>the cursor to display while the grab is active. If this is <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> thenthe normal cursors are used for <em class="parameter"><code>window</code></em> and its descendants, and the cursorfor <em class="parameter"><code>window</code></em> is used for all other windows.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>time_</code></em> :</span></p></td><td>the timestamp of the event which led to this pointer grab. This usuallycomes from a <a class="link" href="gdk-Event-Structures.html#GdkEventButton"><span class="type">GdkEventButton</span></a> struct, though <a class="link" href="gdk-Events.html#GDK-CURRENT-TIME:CAPS"><code class="literal">GDK_CURRENT_TIME</code></a> can be used ifthe time isn't known.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><a class="link" href="gdk-General.html#GDK-GRAB-SUCCESS:CAPS"><code class="literal">GDK_GRAB_SUCCESS</code></a> if the grab was successful.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3047060"></a><h3><a name="GdkGrabStatus"></a>enum GdkGrabStatus</h3><a class="indexterm" name="id3047070"></a><pre class="programlisting">typedef enum{ GDK_GRAB_SUCCESS = 0, GDK_GRAB_ALREADY_GRABBED = 1, GDK_GRAB_INVALID_TIME = 2, GDK_GRAB_NOT_VIEWABLE = 3, GDK_GRAB_FROZEN = 4} GdkGrabStatus;</pre><p>Returned by <a class="link" href="gdk-General.html#gdk-pointer-grab"><code class="function">gdk_pointer_grab()</code></a> and <a class="link" href="gdk-General.html#gdk-keyboard-grab"><code class="function">gdk_keyboard_grab()</code></a> to indicate success or the reason for the failure of the grab attempt.</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a name="GDK-GRAB-SUCCESS:CAPS"></a><code class="literal">GDK_GRAB_SUCCESS</code></span></p></td><td>the resource was successfully grabbed.</td></tr><tr><td><p><span class="term"><a name="GDK-GRAB-ALREADY-GRABBED:CAPS"></a><code class="literal">GDK_GRAB_ALREADY_GRABBED</code></span></p></td><td>the resource is actively grabbed by another client.</td></tr><tr><td><p><span class="term"><a name="GDK-GRAB-INVALID-TIME:CAPS"></a><code class="literal">GDK_GRAB_INVALID_TIME</code></span></p></td><td>the resource was grabbed more recently than the specified time.</td></tr><tr><td><p><span class="term"><a name="GDK-GRAB-NOT-VIEWABLE:CAPS"></a><code class="literal">GDK_GRAB_NOT_VIEWABLE</code></span></p></td><td>the grab window or the <em class="parameter"><code>confine_to</code></em> window are not viewable.</td></tr><tr><td><p><span class="term"><a name="GDK-GRAB-FROZEN:CAPS"></a><code class="literal">GDK_GRAB_FROZEN</code></span></p></td><td>the resource is frozen by an active grab of another client.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3047215"></a><h3><a name="gdk-pointer-ungrab"></a>gdk_pointer_ungrab ()</h3><a class="indexterm" name="id3047225"></a><pre class="programlisting">void gdk_pointer_ungrab (<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#guint32">guint32</a> time_);</pre><p>Ungrabs the pointer on the default display, if it is grabbed by this application.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>time_</code></em> :</span></p></td><td> a timestamp from a <a class="link" href="gdk-Event-Structures.html#GdkEvent"><span class="type">GdkEvent</span></a>, or <a class="link" href="gdk-Events.html#GDK-CURRENT-TIME:CAPS"><code class="literal">GDK_CURRENT_TIME</code></a> if no timestamp is available.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id3047286"></a><h3><a name="gdk-pointer-is-grabbed"></a>gdk_pointer_is_grabbed ()</h3><a class="indexterm" name="id3047296"></a><pre class="programlisting"><ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> gdk_pointer_is_grabbed (void);</pre><p>Returns <ahref="/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the pointer on the default display is currently
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -