From: Taylor R Campbell Date: Sun, 21 Mar 2010 19:27:22 +0000 (-0400) Subject: Fix recent change to xwindow extra structures. X-Git-Tag: 20100708-Gtk~81 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=683cd9fd7a69a72e65e9952eefa225239e7ce3c9;p=mit-scheme.git Fix recent change to xwindow extra structures. --- diff --git a/src/microcode/x11.h b/src/microcode/x11.h index 37baacfe8..65bd7bd00 100644 --- a/src/microcode/x11.h +++ b/src/microcode/x11.h @@ -198,8 +198,6 @@ struct xwindow /* The offset we need to add to compensate for type A WMs. */ int move_offset_x; int move_offset_y; - - void * extra; }; #define XW_ALLOCATION_INDEX(xw) ((xw) -> allocation_index) @@ -326,7 +324,7 @@ extern struct xwindow * x_make_window int y_size, struct drawing_attributes * attributes, struct xwindow_methods * methods, - unsigned int extra); + unsigned int size); extern void xw_set_wm_input_hint (struct xwindow * xw, int input_hint); extern void xw_set_wm_name (struct xwindow * xw, const char * name); diff --git a/src/microcode/x11base.c b/src/microcode/x11base.c index f59c3533a..52709a040 100644 --- a/src/microcode/x11base.c +++ b/src/microcode/x11base.c @@ -569,7 +569,7 @@ x_make_window (struct xdisplay * xd, int y_size, struct drawing_attributes * attributes, struct xwindow_methods * methods, - unsigned int extra) + unsigned int size) { GC normal_gc; GC reverse_gc; @@ -591,9 +591,9 @@ x_make_window (struct xdisplay * xd, background_pixel); XDefineCursor (display, window, mouse_cursor); XSelectInput (display, window, 0); - xw - = (x_malloc (((sizeof (struct xwindow)) - (sizeof (xw->extra))) - + extra)); + if (size < (sizeof (struct xwindow))) + error_external_return (); + xw = (x_malloc (size)); (XW_ALLOCATION_INDEX (xw)) = (allocate_table_index ((&x_window_table), xw)); (XW_XD (xw)) = xd; (XW_WINDOW (xw)) = window; diff --git a/src/microcode/x11graph.c b/src/microcode/x11graph.c index 2cefdde2f..30cde37f4 100644 --- a/src/microcode/x11graph.c +++ b/src/microcode/x11graph.c @@ -45,7 +45,13 @@ struct gw_extra int y_cursor; }; -#define XW_EXTRA(xw) ((struct gw_extra *) ((xw) -> extra)) +struct xwindow_graphics +{ + struct xwindow xw; + struct gw_extra extra; +}; + +#define XW_EXTRA(xw) (& (((struct xwindow_graphics *) xw) -> extra)) #define XW_X_LEFT(xw) ((XW_EXTRA (xw)) -> x_left) #define XW_X_RIGHT(xw) ((XW_EXTRA (xw)) -> x_right) @@ -370,7 +376,7 @@ If third argument SUPPRESS-MAP? is true, do not map the window immediately.") struct xwindow * xw = (x_make_window (xd, window, x_size, y_size, (&attributes), (&methods), - (sizeof (struct gw_extra)))); + (sizeof (struct xwindow_graphics)))); (XW_X_LEFT (xw)) = ((float) (-1)); (XW_X_RIGHT (xw)) = ((float) 1); (XW_Y_BOTTOM (xw)) = ((float) (-1)); diff --git a/src/microcode/x11term.c b/src/microcode/x11term.c index 8f8725095..35c0fa498 100644 --- a/src/microcode/x11term.c +++ b/src/microcode/x11term.c @@ -55,7 +55,13 @@ struct xterm_extra char cursor_enabled_p; }; -#define XW_EXTRA(xw) ((struct xterm_extra *) ((xw) -> extra)) +struct xwindow_term +{ + struct xwindow xw; + struct xterm_extra extra; +}; + +#define XW_EXTRA(xw) (& (((struct xwindow_term *) xw) -> extra)) #define XW_X_CSIZE(xw) ((XW_EXTRA (xw)) -> x_size) #define XW_Y_CSIZE(xw) ((XW_EXTRA (xw)) -> y_size) @@ -534,7 +540,7 @@ DEFINE_PRIMITIVE ("XTERM-OPEN-WINDOW", Prim_xterm_open_window, 3, 3, 0) (y_size - (size_hints->base_height)), (&attributes), (&methods), - (sizeof (struct xterm_extra)))); + (sizeof (struct xwindow_term)))); (XW_X_CSIZE (xw)) = x_csize; (XW_Y_CSIZE (xw)) = y_csize; (XW_CURSOR_X (xw)) = 0;