diff options
author | Owen Taylor <otaylor@src.gnome.org> | 2000-03-14 19:57:25 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-03-14 19:57:25 +0000 |
commit | 10ba4fd066042b4335ae45e7560565872f71ba9b (patch) | |
tree | 17f68ffb0d402b6e66bb891d4a7d9a02a9b6108b /gdk/x11 | |
parent | 3f98a849c70ae570b78095cef0152a33ec07c64e (diff) | |
download | gtk+-10ba4fd066042b4335ae45e7560565872f71ba9b.tar.gz |
Merges from gtk-1-2
Diffstat (limited to 'gdk/x11')
-rw-r--r-- | gdk/x11/gdkcolor-x11.c | 4 | ||||
-rw-r--r-- | gdk/x11/gdkdnd-x11.c | 52 | ||||
-rw-r--r-- | gdk/x11/gdkfont-x11.c | 4 | ||||
-rw-r--r-- | gdk/x11/gdkim-x11.c | 2 | ||||
-rw-r--r-- | gdk/x11/gdkinput.c | 2 | ||||
-rw-r--r-- | gdk/x11/gdkmain-x11.c | 11 | ||||
-rw-r--r-- | gdk/x11/gdkpixmap-x11.c | 20 | ||||
-rw-r--r-- | gdk/x11/gdkproperty-x11.c | 18 | ||||
-rw-r--r-- | gdk/x11/gdkselection-x11.c | 24 | ||||
-rw-r--r-- | gdk/x11/gdkwindow-x11.c | 6 | ||||
-rw-r--r-- | gdk/x11/gxid.c | 2 |
11 files changed, 80 insertions, 65 deletions
diff --git a/gdk/x11/gdkcolor-x11.c b/gdk/x11/gdkcolor-x11.c index 26994cbe8b..7759fb5f1b 100644 --- a/gdk/x11/gdkcolor-x11.c +++ b/gdk/x11/gdkcolor-x11.c @@ -43,7 +43,7 @@ static GHashTable *colormap_hash = NULL; GdkColormap* gdk_colormap_new (GdkVisual *visual, - gint private_cmap) + gboolean private_cmap) { GdkColormap *colormap; GdkColormapPrivateX *private; @@ -344,7 +344,7 @@ gdk_colormap_change (GdkColormap *colormap, gboolean gdk_colors_alloc (GdkColormap *colormap, - gint contiguous, + gboolean contiguous, gulong *planes, gint nplanes, gulong *pixels, diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index 653f2086d4..590c4174d1 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -950,6 +950,7 @@ motif_read_target_table (void) guchar *p; gboolean success = FALSE; + gdk_error_trap_push (); XGetWindowProperty (gdk_display, motif_drag_window, motif_drag_targets_atom, 0, (sizeof(MotifTargetTableHeader)+3)/4, FALSE, @@ -957,12 +958,13 @@ motif_read_target_table (void) &type, &format, &nitems, &bytes_after, (guchar **)&header); - if ((format != 8) || (nitems < sizeof (MotifTargetTableHeader))) + if (gdk_error_trap_pop () || (format != 8) || (nitems < sizeof (MotifTargetTableHeader))) goto error; header->n_lists = card16_to_host (header->n_lists, header->byte_order); header->total_size = card32_to_host (header->total_size, header->byte_order); + gdk_error_trap_push (); XGetWindowProperty (gdk_display, motif_drag_window, motif_drag_targets_atom, (sizeof(MotifTargetTableHeader)+3)/4, (header->total_size + 3)/4 - (sizeof(MotifTargetTableHeader) + 3)/4, @@ -970,7 +972,7 @@ motif_read_target_table (void) motif_drag_targets_atom, &type, &format, &nitems, &bytes_after, &target_bytes); - if ((format != 8) || (bytes_after != 0) || + if (gdk_error_trap_pop () || (format != 8) || (bytes_after != 0) || (nitems != header->total_size - sizeof(MotifTargetTableHeader))) goto error; @@ -1294,29 +1296,33 @@ motif_check_dest (Window win) if (!motif_drag_receiver_info_atom) motif_drag_receiver_info_atom = gdk_atom_intern ("_MOTIF_DRAG_RECEIVER_INFO", FALSE); + gdk_error_trap_push (); XGetWindowProperty (gdk_display, win, motif_drag_receiver_info_atom, 0, (sizeof(*info)+3)/4, False, AnyPropertyType, &type, &format, &nitems, &after, (guchar **)&info); - - if (type != None) + + if (gdk_error_trap_pop() == 0) { - if ((format == 8) && (nitems == sizeof(*info))) - { - if ((info->protocol_version == 0) && - ((info->protocol_style == XmDRAG_PREFER_PREREGISTER) || - (info->protocol_style == XmDRAG_PREFER_DYNAMIC) || - (info->protocol_style == XmDRAG_DYNAMIC))) - retval = TRUE; - } - else + if (type != None) { - GDK_NOTE (DND, - g_warning ("Invalid Motif drag receiver property on window %ld\n", win)); + if ((format == 8) && (nitems == sizeof(*info))) + { + if ((info->protocol_version == 0) && + ((info->protocol_style == XmDRAG_PREFER_PREREGISTER) || + (info->protocol_style == XmDRAG_PREFER_DYNAMIC) || + (info->protocol_style == XmDRAG_DYNAMIC))) + retval = TRUE; + } + else + { + GDK_NOTE (DND, + g_warning ("Invalid Motif drag receiver property on window %ld\n", win)); + } + + XFree (info); } - - XFree (info); } return retval ? win : GDK_NONE; @@ -1475,13 +1481,14 @@ motif_read_initiator_info (Window source_window, if (!motif_drag_initiator_info) motif_drag_initiator_info = gdk_atom_intern ("_MOTIF_DRAG_INITIATOR_INFO", FALSE); + gdk_error_trap_push (); XGetWindowProperty (gdk_display, source_window, atom, 0, sizeof(*initiator_info), FALSE, motif_drag_initiator_info, &type, &format, &nitems, &bytes_after, (guchar **)&initiator_info); - if ((format != 8) || (nitems != sizeof (MotifDragInitiatorInfo)) || (bytes_after != 0)) + if (gdk_error_trap_pop () || (format != 8) || (nitems != sizeof (MotifDragInitiatorInfo)) || (bytes_after != 0)) { g_warning ("Error reading initiator info\n"); return FALSE; @@ -2308,7 +2315,7 @@ xdnd_check_dest (Window win) { if ((format == 32) && (nitems == 1)) { - if (*version == 3) + if (*version >= 3) retval = TRUE; } else @@ -2511,13 +2518,14 @@ xdnd_enter_filter (GdkXEvent *xev, new_context->targets = NULL; if (get_types) { + gdk_error_trap_push (); XGetWindowProperty (GDK_DRAWABLE_XDISPLAY (event->any.window), source_window, gdk_atom_intern ("XdndTypeList", FALSE), 0, 65536, False, XA_ATOM, &type, &format, &nitems, &after, (guchar **)&data); - if ((format != 32) || (type != XA_ATOM)) + if (gdk_error_trap_pop () || (format != 32) || (type != XA_ATOM)) { gdk_drag_context_unref (new_context); return GDK_FILTER_REMOVE; @@ -2779,10 +2787,12 @@ gdk_drag_get_protocol (guint32 xid, if (xid == gdk_root_window) rootwin = TRUE; + gdk_error_warnings = 0; + if (!rootwin) { gdk_error_code = 0; - + XGetWindowProperty (gdk_display, xid, gdk_atom_intern ("ENLIGHTENMENT_DESKTOP", FALSE), 0, 0, False, AnyPropertyType, diff --git a/gdk/x11/gdkfont-x11.c b/gdk/x11/gdkfont-x11.c index 55b4524fce..b4e1020bca 100644 --- a/gdk/x11/gdkfont-x11.c +++ b/gdk/x11/gdkfont-x11.c @@ -134,7 +134,7 @@ gdk_font_load (const gchar *font_name) } GdkFont* -gdk_fontset_load (gchar *fontset_name) +gdk_fontset_load (const gchar *fontset_name) { GdkFont *font; GdkFontPrivateX *private; @@ -276,7 +276,7 @@ gdk_font_id (const GdkFont *font) } } -gint +gboolean gdk_font_equal (const GdkFont *fonta, const GdkFont *fontb) { diff --git a/gdk/x11/gdkim-x11.c b/gdk/x11/gdkim-x11.c index a13d1a6124..6ad29752e3 100644 --- a/gdk/x11/gdkim-x11.c +++ b/gdk/x11/gdkim-x11.c @@ -445,7 +445,7 @@ gdk_im_close (void) } } -gint +gboolean gdk_im_ready (void) { return (xim_im != NULL); diff --git a/gdk/x11/gdkinput.c b/gdk/x11/gdkinput.c index 348251458d..cb2dd269c7 100644 --- a/gdk/x11/gdkinput.c +++ b/gdk/x11/gdkinput.c @@ -73,7 +73,7 @@ gdk_input_set_source (guint32 deviceid, GdkInputSource source) gdkdev->info.source = source; } -gint +gboolean gdk_input_set_mode (guint32 deviceid, GdkInputMode mode) { if (deviceid == GDK_CORE_POINTER) diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index de696cca98..332ad77183 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -42,7 +42,6 @@ #include <X11/Xlib.h> #include <X11/Xos.h> #include <X11/Xutil.h> -#include <X11/Xmu/WinUtil.h> #include <X11/cursorfont.h> #include "gdk.h" @@ -191,12 +190,12 @@ _gdk_windowing_init_check (int argc, char **argv) } void -gdk_set_use_xshm (gint use_xshm) +gdk_set_use_xshm (gboolean use_xshm) { gdk_use_xshm = use_xshm; } -gint +gboolean gdk_get_use_xshm (void) { return gdk_use_xshm; @@ -227,7 +226,7 @@ gdk_get_use_xshm (void) gint gdk_pointer_grab (GdkWindow * window, - gint owner_events, + gboolean owner_events, GdkEventMask event_mask, GdkWindow * confine_to, GdkCursor * cursor, @@ -337,7 +336,7 @@ gdk_pointer_ungrab (guint32 time) *-------------------------------------------------------------- */ -gint +gboolean gdk_pointer_is_grabbed (void) { return gdk_xgrab_window != NULL; @@ -365,7 +364,7 @@ gdk_pointer_is_grabbed (void) gint gdk_keyboard_grab (GdkWindow * window, - gint owner_events, + gboolean owner_events, guint32 time) { g_return_val_if_fail (window != NULL, 0); diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c index c27517c9a3..45807cb613 100644 --- a/gdk/x11/gdkpixmap-x11.c +++ b/gdk/x11/gdkpixmap-x11.c @@ -212,21 +212,23 @@ gdk_pixmap_seek_string (FILE *infile, { char instr[1024]; - while (!feof (infile)) + while (1) { - fscanf (infile, "%1023s", instr); + if (fscanf (infile, "%1023s", instr) != 1) + return FALSE; + if (skip_comments == TRUE && strcmp (instr, "/*") == 0) { - fscanf (infile, "%1023s", instr); - while (!feof (infile) && strcmp (instr, "*/") != 0) - fscanf (infile, "%1023s", instr); - fscanf(infile, "%1023s", instr); + do + { + if (fscanf (infile, "%1023s", instr) != 1) + return FALSE; + } + while (strcmp (instr, "*/") != 0); } - if (strcmp (instr, str)==0) + else if (strcmp (instr, str) == 0) return TRUE; } - - return FALSE; } static gint diff --git a/gdk/x11/gdkproperty-x11.c b/gdk/x11/gdkproperty-x11.c index 54fa55c51f..58b51a9712 100644 --- a/gdk/x11/gdkproperty-x11.c +++ b/gdk/x11/gdkproperty-x11.c @@ -91,7 +91,7 @@ gdk_atom_name (GdkAtom atom) } } -gint +gboolean gdk_property_get (GdkWindow *window, GdkAtom property, GdkAtom type, @@ -190,13 +190,13 @@ gdk_property_get (GdkWindow *window, } void -gdk_property_change (GdkWindow *window, - GdkAtom property, - GdkAtom type, - gint format, - GdkPropMode mode, - guchar *data, - gint nelements) +gdk_property_change (GdkWindow *window, + GdkAtom property, + GdkAtom type, + gint format, + GdkPropMode mode, + const guchar *data, + gint nelements) { Display *xdisplay; Window xwindow; @@ -219,7 +219,7 @@ gdk_property_change (GdkWindow *window, } XChangeProperty (xdisplay, xwindow, property, type, - format, mode, data, nelements); + format, mode, (guchar *)data, nelements); } void diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index e1272f4213..42e00195ed 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -34,11 +34,11 @@ #include "gdkx.h" -gint +gboolean gdk_selection_owner_set (GdkWindow *owner, GdkAtom selection, guint32 time, - gint send_event) + gboolean send_event) { Display *xdisplay; Window xwindow; @@ -187,9 +187,11 @@ gdk_selection_send_notify (guint32 requestor, } gint -gdk_text_property_to_text_list (GdkAtom encoding, gint format, - guchar *text, gint length, - gchar ***list) +gdk_text_property_to_text_list (GdkAtom encoding, + gint format, + const guchar *text, + gint length, + gchar ***list) { XTextProperty property; gint count = 0; @@ -198,7 +200,7 @@ gdk_text_property_to_text_list (GdkAtom encoding, gint format, if (!list) return 0; - property.value = text; + property.value = (guchar *)text; property.encoding = encoding; property.format = format; property.nitems = length; @@ -220,15 +222,17 @@ gdk_free_text_list (gchar **list) } gint -gdk_string_to_compound_text (gchar *str, - GdkAtom *encoding, gint *format, - guchar **ctext, gint *length) +gdk_string_to_compound_text (const gchar *str, + GdkAtom *encoding, + gint *format, + guchar **ctext, + gint *length) { gint res; XTextProperty property; res = XmbTextListToTextProperty (GDK_DISPLAY(), - &str, 1, XCompoundTextStyle, + (char **)&str, 1, XCompoundTextStyle, &property); if (res != Success) { diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 26cbcb8c2b..fe1be34a49 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -1069,7 +1069,7 @@ gdk_window_set_background (GdkWindow *window, void gdk_window_set_back_pixmap (GdkWindow *window, GdkPixmap *pixmap, - gint parent_relative) + gboolean parent_relative) { Pixmap xpixmap; @@ -1643,8 +1643,8 @@ gdk_window_set_icon (GdkWindow *window, } void -gdk_window_set_icon_name (GdkWindow *window, - gchar * name) +gdk_window_set_icon_name (GdkWindow *window, + const gchar *name) { XTextProperty property; gint res; diff --git a/gdk/x11/gxid.c b/gdk/x11/gxid.c index 5eb4b7f855..2b0994cbcb 100644 --- a/gdk/x11/gxid.c +++ b/gdk/x11/gxid.c @@ -355,7 +355,7 @@ handle_claim_device(GxidClaimDevice *msg) { /* FIXME: this is a bit improper. We probably should do this only when a window is first claimed. But we might be fooled if - an old client died without releasing its windows. So until + an old client died without releasing it's windows. So until we look for client-window closings, do it here (We do look for closings now...) |