diff options
author | Owen Taylor <otaylor@redhat.com> | 1999-02-21 20:55:04 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1999-02-21 20:55:04 +0000 |
commit | 25cdbd356057a4e8d3a654487a739a279fa96068 (patch) | |
tree | f55f54f575c9e3502639460a09e69ae84c8dd643 /gdk | |
parent | 295e763b4da13726b7beb8e9c905a5af30b0e251 (diff) | |
download | gtk+-25cdbd356057a4e8d3a654487a739a279fa96068.tar.gz |
Account for the fact that Xlib expects format == 32 to be a long, even on
Sun Feb 21 15:59:55 1999 Owen Taylor <otaylor@redhat.com>
* gdk/MwmUtil.h gdk/gdkwindow.c: Account for the
fact that Xlib expects format == 32 to be a long,
even on 64-bit architectures.
[ patch from George Lebl (jirka@5z.com) ]
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/MwmUtil.h | 32 | ||||
-rw-r--r-- | gdk/gdk.c | 30 | ||||
-rw-r--r-- | gdk/gdk.h | 2 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 4 | ||||
-rw-r--r-- | gdk/x11/MwmUtil.h | 32 | ||||
-rw-r--r-- | gdk/x11/gdkmain-x11.c | 30 | ||||
-rw-r--r-- | gdk/x11/gdkwindow-x11.c | 4 |
7 files changed, 86 insertions, 48 deletions
diff --git a/gdk/MwmUtil.h b/gdk/MwmUtil.h index 9f4e3a29b2..53925f685a 100644 --- a/gdk/MwmUtil.h +++ b/gdk/MwmUtil.h @@ -21,6 +21,14 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * + * + * * Feb 21 1999 - George Lebl (jirka@5z.com) + * Owen Taylor (otaylor@redhat.com) + * + * Modified so that the MotifWmHints structure defined here + * is suitable for client side use on 64-bit architectures. + * X expects fields with a format of 32 to be longs, even + * when sizeof(long) == 8. **/ #ifndef MWMUTIL_H_INCLUDED @@ -33,11 +41,11 @@ extern "C" { #endif typedef struct { - CARD32 flags; - CARD32 functions; - CARD32 decorations; - INT32 input_mode; - CARD32 status; + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long input_mode; + unsigned long status; } MotifWmHints, MwmHints; #define MWM_HINTS_FUNCTIONS (1L << 0) @@ -100,11 +108,11 @@ typedef MotifWmInfo MwmInfo; * _MWM_HINTS property */ typedef struct { - CARD32 flags; - CARD32 functions; - CARD32 decorations; - INT32 inputMode; - CARD32 status; + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long inputMode; + unsigned long status; } PropMotifWmHints; typedef PropMotifWmHints PropMwmHints; @@ -116,8 +124,8 @@ typedef PropMotifWmHints PropMwmHints; * _MWM_INFO property, slight return */ typedef struct { - CARD32 flags; - CARD32 wmWindow; + unsigned long flags; + unsigned long wmWindow; } PropMotifWmInfo; typedef PropMotifWmInfo PropMwmInfo; @@ -124,7 +124,7 @@ static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey); /* *-------------------------------------------------------------- - * gdk_init + * gdk_init_heck * * Initialize the library for use. * @@ -135,7 +135,8 @@ static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey); * Results: * "argc" and "argv" are modified to reflect any arguments * which were not handled. (Such arguments should either - * be handled by the application or dismissed). + * be handled by the application or dismissed). If initialization + * fails, returns FALSE, otherwise TRUE. * * Side effects: * The library is initialized. @@ -143,9 +144,9 @@ static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey); *-------------------------------------------------------------- */ -void -gdk_init (int *argc, - char ***argv) +gboolean +gdk_init_check (int *argc, + char ***argv) { XKeyboardState keyboard_state; gint synchronize; @@ -155,7 +156,7 @@ gdk_init (int *argc, gint argc_orig = 0; if (gdk_initialized) - return; + return TRUE; if (g_thread_supported ()) gdk_threads_mutex = g_mutex_new (); @@ -370,10 +371,7 @@ gdk_init (int *argc, gdk_display = XOpenDisplay (gdk_display_name); if (!gdk_display) - { - g_warning ("cannot open display: %s", XDisplayName (gdk_display_name)); - exit(1); - } + return FALSE; if (synchronize) XSynchronize (gdk_display, True); @@ -428,6 +426,18 @@ gdk_init (int *argc, #endif gdk_initialized = 1; + + return TRUE; +} + +void +gdk_init (int *argc, char ***argv) +{ + if (!gdk_init_check (argc, argv)) + { + g_warning ("cannot open display: %s", gdk_get_display ()); + exit(1); + } } /* @@ -32,6 +32,8 @@ extern "C" { #define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT) void gdk_init (gint *argc, gchar ***argv); +gboolean gdk_init_check (gint *argc, + gchar ***argv); void gdk_exit (gint error_code); gchar* gdk_set_locale (void); diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index c2b8944535..32ced4397e 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -2131,7 +2131,7 @@ gdk_window_set_mwm_hints (GdkWindow *window, _XA_MOTIF_WM_HINTS, FALSE); XGetWindowProperty (window_private->xdisplay, window_private->xwindow, - hints_atom, 0, sizeof (MotifWmHints)/4, + hints_atom, 0, sizeof (MotifWmHints)/sizeof (long), False, AnyPropertyType, &type, &format, &nitems, &bytes_after, (guchar **)&hints); @@ -2153,7 +2153,7 @@ gdk_window_set_mwm_hints (GdkWindow *window, XChangeProperty (window_private->xdisplay, window_private->xwindow, hints_atom, hints_atom, 32, PropModeReplace, - (guchar *)hints, sizeof (MotifWmHints)/4); + (guchar *)hints, sizeof (MotifWmHints)/sizeof (long)); if (hints != new_hints) XFree (hints); diff --git a/gdk/x11/MwmUtil.h b/gdk/x11/MwmUtil.h index 9f4e3a29b2..53925f685a 100644 --- a/gdk/x11/MwmUtil.h +++ b/gdk/x11/MwmUtil.h @@ -21,6 +21,14 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * + * + * * Feb 21 1999 - George Lebl (jirka@5z.com) + * Owen Taylor (otaylor@redhat.com) + * + * Modified so that the MotifWmHints structure defined here + * is suitable for client side use on 64-bit architectures. + * X expects fields with a format of 32 to be longs, even + * when sizeof(long) == 8. **/ #ifndef MWMUTIL_H_INCLUDED @@ -33,11 +41,11 @@ extern "C" { #endif typedef struct { - CARD32 flags; - CARD32 functions; - CARD32 decorations; - INT32 input_mode; - CARD32 status; + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long input_mode; + unsigned long status; } MotifWmHints, MwmHints; #define MWM_HINTS_FUNCTIONS (1L << 0) @@ -100,11 +108,11 @@ typedef MotifWmInfo MwmInfo; * _MWM_HINTS property */ typedef struct { - CARD32 flags; - CARD32 functions; - CARD32 decorations; - INT32 inputMode; - CARD32 status; + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long inputMode; + unsigned long status; } PropMotifWmHints; typedef PropMotifWmHints PropMwmHints; @@ -116,8 +124,8 @@ typedef PropMotifWmHints PropMwmHints; * _MWM_INFO property, slight return */ typedef struct { - CARD32 flags; - CARD32 wmWindow; + unsigned long flags; + unsigned long wmWindow; } PropMotifWmInfo; typedef PropMotifWmInfo PropMwmInfo; diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index f4d5f7b808..f10a898308 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -124,7 +124,7 @@ static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey); /* *-------------------------------------------------------------- - * gdk_init + * gdk_init_heck * * Initialize the library for use. * @@ -135,7 +135,8 @@ static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey); * Results: * "argc" and "argv" are modified to reflect any arguments * which were not handled. (Such arguments should either - * be handled by the application or dismissed). + * be handled by the application or dismissed). If initialization + * fails, returns FALSE, otherwise TRUE. * * Side effects: * The library is initialized. @@ -143,9 +144,9 @@ static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey); *-------------------------------------------------------------- */ -void -gdk_init (int *argc, - char ***argv) +gboolean +gdk_init_check (int *argc, + char ***argv) { XKeyboardState keyboard_state; gint synchronize; @@ -155,7 +156,7 @@ gdk_init (int *argc, gint argc_orig = 0; if (gdk_initialized) - return; + return TRUE; if (g_thread_supported ()) gdk_threads_mutex = g_mutex_new (); @@ -370,10 +371,7 @@ gdk_init (int *argc, gdk_display = XOpenDisplay (gdk_display_name); if (!gdk_display) - { - g_warning ("cannot open display: %s", XDisplayName (gdk_display_name)); - exit(1); - } + return FALSE; if (synchronize) XSynchronize (gdk_display, True); @@ -428,6 +426,18 @@ gdk_init (int *argc, #endif gdk_initialized = 1; + + return TRUE; +} + +void +gdk_init (int *argc, char ***argv) +{ + if (!gdk_init_check (argc, argv)) + { + g_warning ("cannot open display: %s", gdk_get_display ()); + exit(1); + } } /* diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index c2b8944535..32ced4397e 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -2131,7 +2131,7 @@ gdk_window_set_mwm_hints (GdkWindow *window, _XA_MOTIF_WM_HINTS, FALSE); XGetWindowProperty (window_private->xdisplay, window_private->xwindow, - hints_atom, 0, sizeof (MotifWmHints)/4, + hints_atom, 0, sizeof (MotifWmHints)/sizeof (long), False, AnyPropertyType, &type, &format, &nitems, &bytes_after, (guchar **)&hints); @@ -2153,7 +2153,7 @@ gdk_window_set_mwm_hints (GdkWindow *window, XChangeProperty (window_private->xdisplay, window_private->xwindow, hints_atom, hints_atom, 32, PropModeReplace, - (guchar *)hints, sizeof (MotifWmHints)/4); + (guchar *)hints, sizeof (MotifWmHints)/sizeof (long)); if (hints != new_hints) XFree (hints); |