no more xid or id fields

This commit is contained in:
TORRI Vincent 2007-02-07 18:57:46 +01:00
parent 6cedaece0e
commit 8a8c1fa184

View File

@ -705,7 +705,7 @@ main ()
} }
printf ("\n"); printf ("\n");
printf ("Informations of screen %ld:\n", screen->root.xid); printf ("Informations of screen %ld:\n", screen->root);
printf (" width.........: %d\n", screen->width_in_pixels); printf (" width.........: %d\n", screen->width_in_pixels);
printf (" height........: %d\n", screen->height_in_pixels); printf (" height........: %d\n", screen->height_in_pixels);
printf (" white pixel...: %ld\n", screen->white_pixel); printf (" white pixel...: %ld\n", screen->white_pixel);
@ -722,9 +722,7 @@ main ()
characterized by an Id. So, in XCB, a window is of type: characterized by an Id. So, in XCB, a window is of type:
</p> </p>
<pre class="code"> <pre class="code">
typedef struct { typedef uint32_t xcb_window_t;
uint32_t xid;
} xcb_window_t;
</pre> </pre>
<p> <p>
We first ask for a new Id for our window, with this function: We first ask for a new Id for our window, with this function:
@ -886,9 +884,7 @@ int xcb_aux_sync (xcb_connection_t *c);
a Graphics Context is, as a window, characterized by an Id: a Graphics Context is, as a window, characterized by an Id:
</p> </p>
<pre class="code"> <pre class="code">
typedef struct { typedef uint32_t xcb_gcontext_t;
uint32_t xid;
} xcb_gcontext_t;
</pre> </pre>
<p> <p>
We first ask the X server to attribute an Id to our graphic We first ask the X server to attribute an Id to our graphic
@ -1958,25 +1954,25 @@ main ()
xcb_expose_event_t *ev = (xcb_expose_event_t *)e; xcb_expose_event_t *ev = (xcb_expose_event_t *)e;
printf ("Window %ld exposed. Region to be redrawn at location (%d,%d), with dimension (%d,%d)\n", printf ("Window %ld exposed. Region to be redrawn at location (%d,%d), with dimension (%d,%d)\n",
ev-&gt;window.xid, ev-&gt;x, ev-&gt;y, ev-&gt;width, ev-&gt;height); ev-&gt;window, ev-&gt;x, ev-&gt;y, ev-&gt;width, ev-&gt;height);
break; break;
} }
case XCB_BUTTON_PRESS: { case XCB_BUTTON_PRESS: {
xcb_button_press_event_t *ev = (xcb_button_press_event_t *)e; xcb_button_press_event_t *ev = (xcb_button_press_event_t *)e;
print_modifiers(ev-&gt;state); print_modifiers(ev-&gt;state);
switch (ev-&gt;detail.id) { switch (ev-&gt;detail) {
case 4: case 4:
printf ("Wheel Button up in window %ld, at coordinates (%d,%d)\n", printf ("Wheel Button up in window %ld, at coordinates (%d,%d)\n",
ev-&gt;event.xid, ev-&gt;event_x, ev-&gt;event_y); ev-&gt;event, ev-&gt;event_x, ev-&gt;event_y);
break; break;
case 5: case 5:
printf ("Wheel Button down in window %ld, at coordinates (%d,%d)\n", printf ("Wheel Button down in window %ld, at coordinates (%d,%d)\n",
ev-&gt;event.xid, ev-&gt;event_x, ev-&gt;event_y); ev-&gt;event, ev-&gt;event_x, ev-&gt;event_y);
break; break;
default: default:
printf ("Button %d pressed in window %ld, at coordinates (%d,%d)\n", printf ("Button %d pressed in window %ld, at coordinates (%d,%d)\n",
ev-&gt;detail.id, ev-&gt;event.xid, ev-&gt;event_x, ev-&gt;event_y); ev-&gt;detail, ev-&gt;event, ev-&gt;event_x, ev-&gt;event_y);
} }
break; break;
} }
@ -1985,28 +1981,28 @@ main ()
print_modifiers(ev-&gt;state); print_modifiers(ev-&gt;state);
printf ("Button %d released in window %ld, at coordinates (%d,%d)\n", printf ("Button %d released in window %ld, at coordinates (%d,%d)\n",
ev-&gt;detail.id, ev-&gt;event.xid, ev-&gt;event_x, ev-&gt;event_y); ev-&gt;detail, ev-&gt;event, ev-&gt;event_x, ev-&gt;event_y);
break; break;
} }
case XCB_MOTION_NOTIFY: { case XCB_MOTION_NOTIFY: {
xcb_motion_notify_event_t *ev = (xcb_motion_notify_event_t *)e; xcb_motion_notify_event_t *ev = (xcb_motion_notify_event_t *)e;
printf ("Mouse moved in window %ld, at coordinates (%d,%d)\n", printf ("Mouse moved in window %ld, at coordinates (%d,%d)\n",
ev-&gt;event.xid, ev-&gt;event_x, ev-&gt;event_y); ev-&gt;event, ev-&gt;event_x, ev-&gt;event_y);
break; break;
} }
case XCB_ENTER_NOTIFY: { case XCB_ENTER_NOTIFY: {
xcb_enter_notify_event_t *ev = (xcb_enter_notify_event_t *)e; xcb_enter_notify_event_t *ev = (xcb_enter_notify_event_t *)e;
printf ("Mouse entered window %ld, at coordinates (%d,%d)\n", printf ("Mouse entered window %ld, at coordinates (%d,%d)\n",
ev-&gt;event.xid, ev-&gt;event_x, ev-&gt;event_y); ev-&gt;event, ev-&gt;event_x, ev-&gt;event_y);
break; break;
} }
case XCB_LEAVE_NOTIFY: { case XCB_LEAVE_NOTIFY: {
xcb_leave_notify_event_t *ev = (xcb_leave_notify_event_t *)e; xcb_leave_notify_event_t *ev = (xcb_leave_notify_event_t *)e;
printf ("Mouse left window %ld, at coordinates (%d,%d)\n", printf ("Mouse left window %ld, at coordinates (%d,%d)\n",
ev-&gt;event.xid, ev-&gt;event_x, ev-&gt;event_y); ev-&gt;event, ev-&gt;event_x, ev-&gt;event_y);
break; break;
} }
case XCB_KEY_PRESS: { case XCB_KEY_PRESS: {
@ -2014,7 +2010,7 @@ main ()
print_modifiers(ev-&gt;state); print_modifiers(ev-&gt;state);
printf ("Key pressed in window %ld\n", printf ("Key pressed in window %ld\n",
ev-&gt;event.xid); ev-&gt;event);
break; break;
} }
case XCB_KEY_RELEASE: { case XCB_KEY_RELEASE: {
@ -2022,7 +2018,7 @@ main ()
print_modifiers(ev-&gt;state); print_modifiers(ev-&gt;state);
printf ("Key released in window %ld\n", printf ("Key released in window %ld\n",
ev-&gt;event.xid); ev-&gt;event);
break; break;
} }
default: default:
@ -2054,9 +2050,7 @@ main ()
defined. You know what ? It's an Id: defined. You know what ? It's an Id:
</p> </p>
<pre class="code"> <pre class="code">
typedef struct { typedef uint32_t xcb_font_t;
uint32_t xid;
} xcb_font_t;
</pre> </pre>
<p> <p>
It is used to contain information about a font, and is passed It is used to contain information about a font, and is passed
@ -2096,9 +2090,7 @@ typedef struct {
Id. Their type are <span class="code">xcb_atom_t</span>: Id. Their type are <span class="code">xcb_atom_t</span>:
</p> </p>
<pre class="code"> <pre class="code">
typedef struct { typedef uint32_t xcb_atom_t;
uint32_t xid;
} xcb_atom_t;
</pre> </pre>
<p> <p>
To change the property of a window, we use the following To change the property of a window, we use the following
@ -2658,9 +2650,7 @@ xcb_get_window_attributes_reply_t *xcb_get_window_attributes_reply (xcb_connecti
In XCB, a color map is (as often in X) an Id: In XCB, a color map is (as often in X) an Id:
</p> </p>
<pre class="code"> <pre class="code">
typedef struct { typedef uint32_t xcb_colormap_t;
uint32_t xid;
} xcb_colormap_t;
</pre> </pre>
<p> <p>
In order to access the screen's default color map, you just In order to access the screen's default color map, you just
@ -2901,19 +2891,14 @@ main ()
of X pixmap in XCB is an Id like a window: of X pixmap in XCB is an Id like a window:
</p> </p>
<pre class="code"> <pre class="code">
typedef struct { typedef uint32_t xcb_pixmap_t;
uint32_t xid;
} xcb_pixmap_t;
</pre> </pre>
<p> <p>
In order to make the difference between a window and a pixmap, Like Xlib, there is no difference between a Drawable, a Window
XCB introduces a drawable type, which is a <b>union</b> or a Pixmap:
</p> </p>
<pre class="code"> <pre class="code">
typedef union { typedef uint32_t xcb_drawable_t;
xcb_window_t window;
xcb_pixmap_t pixmap;
} xcb_drawable_t;
</pre> </pre>
<p> <p>
in order to avoid confusion between a window and a pixmap. The in order to avoid confusion between a window and a pixmap. The
@ -3115,7 +3100,7 @@ uint32_t value_list;
/* The cursor is already created */ /* The cursor is already created */
mask = XCB_CWCURSOR; mask = XCB_CWCURSOR;
value_list = cursor.xid; value_list = cursor;
xcb_change_window_attributes (conn, window, mask, &amp;value_list); xcb_change_window_attributes (conn, window, mask, &amp;value_list);
</pre> </pre>
<p> <p>
@ -3910,7 +3895,7 @@ if (screen) {
visual_iter = xcb_depth_visuals_iterator (depth_iter.data); visual_iter = xcb_depth_visuals_iterator (depth_iter.data);
for (; visual_iter.rem; xcb_visualtype_next (&amp;visual_iter)) { for (; visual_iter.rem; xcb_visualtype_next (&amp;visual_iter)) {
if (screen-&gt;root_visual.id == visual_iter.data-&gt;visual_id.id) { if (screen-&gt;root_visual == visual_iter.data-&gt;visual_id) {
visual_type = visual_iter.data; visual_type = visual_iter.data;
break; break;
} }