summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>1999-02-10 08:06:30 +0000
committerTim Janik <timj@src.gnome.org>1999-02-10 08:06:30 +0000
commit88c112cde83285ec9f72f0413c12e5532139ba2f (patch)
treeae42f6c998a0c021381540a13b6afa198d50ecbe
parentd1bda8d56232ff0431796add4029e129f877fd6a (diff)
downloadgdk-pixbuf-88c112cde83285ec9f72f0413c12e5532139ba2f.tar.gz
asure that ->value_buf always points to an allocated area.
Wed Feb 10 08:35:36 1999 Tim Janik <timj@gtk.org> * gtk/gtkcolorsel.c (gtk_color_selection_draw_value_bar): asure that ->value_buf always points to an allocated area. (gtk_color_selection_drag_end): new function hooked up to drag_end to destroy the drag_window. * gtk/gtkdnd.c: some coding style fixups. Wed Feb 10 06:47:17 1999 Tim Janik <timj@gtk.org> * gdk/gdkwindow.c: various indentation fixes. * gdk/gdkevents.c: coding style fixups. NULL initialize event_func, event_notify and event_chunk. (expose_predicate): made this function static. (gdk_event_handler_set): perform destroy notification even if no event_func is set. * gdk/gdkrectangle.c (gdk_rectangle_union): added g_return_if_fail statements.
-rw-r--r--ChangeLog22
-rw-r--r--ChangeLog.pre-2-022
-rw-r--r--ChangeLog.pre-2-1022
-rw-r--r--ChangeLog.pre-2-222
-rw-r--r--ChangeLog.pre-2-422
-rw-r--r--ChangeLog.pre-2-622
-rw-r--r--ChangeLog.pre-2-822
-rw-r--r--gdk/gdkevents.c133
-rw-r--r--gdk/gdkrectangle.c10
-rw-r--r--gdk/gdkwindow.c1313
-rw-r--r--gdk/x11/gdkevents-x11.c133
-rw-r--r--gdk/x11/gdkwindow-x11.c1313
-rw-r--r--gtk/gtkcolorsel.c48
-rw-r--r--gtk/gtkdnd.c817
14 files changed, 2072 insertions, 1849 deletions
diff --git a/ChangeLog b/ChangeLog
index fb61ad7d3..05e7b6a69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+Wed Feb 10 08:35:36 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_draw_value_bar): asure that
+ ->value_buf always points to an allocated area.
+ (gtk_color_selection_drag_end): new function hooked up to drag_end to
+ destroy the drag_window.
+
+ * gtk/gtkdnd.c: some coding style fixups.
+
+Wed Feb 10 06:47:17 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkwindow.c: various indentation fixes.
+
+ * gdk/gdkevents.c: coding style fixups.
+ NULL initialize event_func, event_notify and event_chunk.
+ (expose_predicate): made this function static.
+ (gdk_event_handler_set): perform destroy notification even if no
+ event_func is set.
+
+ * gdk/gdkrectangle.c (gdk_rectangle_union): added g_return_if_fail
+ statements.
+
Sun Feb 7 19:49:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Fixed some
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index fb61ad7d3..05e7b6a69 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,25 @@
+Wed Feb 10 08:35:36 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_draw_value_bar): asure that
+ ->value_buf always points to an allocated area.
+ (gtk_color_selection_drag_end): new function hooked up to drag_end to
+ destroy the drag_window.
+
+ * gtk/gtkdnd.c: some coding style fixups.
+
+Wed Feb 10 06:47:17 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkwindow.c: various indentation fixes.
+
+ * gdk/gdkevents.c: coding style fixups.
+ NULL initialize event_func, event_notify and event_chunk.
+ (expose_predicate): made this function static.
+ (gdk_event_handler_set): perform destroy notification even if no
+ event_func is set.
+
+ * gdk/gdkrectangle.c (gdk_rectangle_union): added g_return_if_fail
+ statements.
+
Sun Feb 7 19:49:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Fixed some
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index fb61ad7d3..05e7b6a69 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,25 @@
+Wed Feb 10 08:35:36 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_draw_value_bar): asure that
+ ->value_buf always points to an allocated area.
+ (gtk_color_selection_drag_end): new function hooked up to drag_end to
+ destroy the drag_window.
+
+ * gtk/gtkdnd.c: some coding style fixups.
+
+Wed Feb 10 06:47:17 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkwindow.c: various indentation fixes.
+
+ * gdk/gdkevents.c: coding style fixups.
+ NULL initialize event_func, event_notify and event_chunk.
+ (expose_predicate): made this function static.
+ (gdk_event_handler_set): perform destroy notification even if no
+ event_func is set.
+
+ * gdk/gdkrectangle.c (gdk_rectangle_union): added g_return_if_fail
+ statements.
+
Sun Feb 7 19:49:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Fixed some
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index fb61ad7d3..05e7b6a69 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,25 @@
+Wed Feb 10 08:35:36 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_draw_value_bar): asure that
+ ->value_buf always points to an allocated area.
+ (gtk_color_selection_drag_end): new function hooked up to drag_end to
+ destroy the drag_window.
+
+ * gtk/gtkdnd.c: some coding style fixups.
+
+Wed Feb 10 06:47:17 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkwindow.c: various indentation fixes.
+
+ * gdk/gdkevents.c: coding style fixups.
+ NULL initialize event_func, event_notify and event_chunk.
+ (expose_predicate): made this function static.
+ (gdk_event_handler_set): perform destroy notification even if no
+ event_func is set.
+
+ * gdk/gdkrectangle.c (gdk_rectangle_union): added g_return_if_fail
+ statements.
+
Sun Feb 7 19:49:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Fixed some
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index fb61ad7d3..05e7b6a69 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,25 @@
+Wed Feb 10 08:35:36 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_draw_value_bar): asure that
+ ->value_buf always points to an allocated area.
+ (gtk_color_selection_drag_end): new function hooked up to drag_end to
+ destroy the drag_window.
+
+ * gtk/gtkdnd.c: some coding style fixups.
+
+Wed Feb 10 06:47:17 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkwindow.c: various indentation fixes.
+
+ * gdk/gdkevents.c: coding style fixups.
+ NULL initialize event_func, event_notify and event_chunk.
+ (expose_predicate): made this function static.
+ (gdk_event_handler_set): perform destroy notification even if no
+ event_func is set.
+
+ * gdk/gdkrectangle.c (gdk_rectangle_union): added g_return_if_fail
+ statements.
+
Sun Feb 7 19:49:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Fixed some
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index fb61ad7d3..05e7b6a69 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,25 @@
+Wed Feb 10 08:35:36 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_draw_value_bar): asure that
+ ->value_buf always points to an allocated area.
+ (gtk_color_selection_drag_end): new function hooked up to drag_end to
+ destroy the drag_window.
+
+ * gtk/gtkdnd.c: some coding style fixups.
+
+Wed Feb 10 06:47:17 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkwindow.c: various indentation fixes.
+
+ * gdk/gdkevents.c: coding style fixups.
+ NULL initialize event_func, event_notify and event_chunk.
+ (expose_predicate): made this function static.
+ (gdk_event_handler_set): perform destroy notification even if no
+ event_func is set.
+
+ * gdk/gdkrectangle.c (gdk_rectangle_union): added g_return_if_fail
+ statements.
+
Sun Feb 7 19:49:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Fixed some
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index fb61ad7d3..05e7b6a69 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,25 @@
+Wed Feb 10 08:35:36 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcolorsel.c (gtk_color_selection_draw_value_bar): asure that
+ ->value_buf always points to an allocated area.
+ (gtk_color_selection_drag_end): new function hooked up to drag_end to
+ destroy the drag_window.
+
+ * gtk/gtkdnd.c: some coding style fixups.
+
+Wed Feb 10 06:47:17 1999 Tim Janik <timj@gtk.org>
+
+ * gdk/gdkwindow.c: various indentation fixes.
+
+ * gdk/gdkevents.c: coding style fixups.
+ NULL initialize event_func, event_notify and event_chunk.
+ (expose_predicate): made this function static.
+ (gdk_event_handler_set): perform destroy notification even if no
+ event_func is set.
+
+ * gdk/gdkrectangle.c (gdk_rectangle_union): added g_return_if_fail
+ statements.
+
Sun Feb 7 19:49:21 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_move_resize): Fixed some
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 3ac781aac..ab67c956b 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -39,21 +39,24 @@ typedef struct _GdkEventPrivate GdkEventPrivate;
#define DOUBLE_CLICK_DIST 5
#define TRIPLE_CLICK_DIST 5
-typedef enum {
+typedef enum
+{
/* Following flag is set for events on the event queue during
* translation and cleared afterwards.
*/
GDK_EVENT_PENDING = 1 << 0
} GdkEventFlags;
-struct _GdkIOClosure {
+struct _GdkIOClosure
+{
GdkInputFunction function;
GdkInputCondition condition;
GdkDestroyNotify notify;
gpointer data;
};
-struct _GdkEventPrivate {
+struct _GdkEventPrivate
+{
GdkEvent event;
guint flags;
};
@@ -63,30 +66,30 @@ struct _GdkEventPrivate {
*/
static GdkEvent *gdk_event_new (void);
-static gint gdk_event_apply_filters (XEvent *xevent,
+static gint gdk_event_apply_filters (XEvent *xevent,
GdkEvent *event,
- GList *filters);
+ GList *filters);
static gint gdk_event_translate (GdkEvent *event,
XEvent *xevent);
#if 0
-static Bool gdk_event_get_type (Display *display,
- XEvent *xevent,
- XPointer arg);
+static Bool gdk_event_get_type (Display *display,
+ XEvent *xevent,
+ XPointer arg);
#endif
static void gdk_events_queue (void);
-static GdkEvent *gdk_event_unqueue (void);
+static GdkEvent* gdk_event_unqueue (void);
-static gboolean gdk_event_prepare (gpointer source_data,
- GTimeVal *current_time,
- gint *timeout);
-static gboolean gdk_event_check (gpointer source_data,
- GTimeVal *current_time);
-static gboolean gdk_event_dispatch (gpointer source_data,
- GTimeVal *current_time,
- gpointer user_data);
+static gboolean gdk_event_prepare (gpointer source_data,
+ GTimeVal *current_time,
+ gint *timeout);
+static gboolean gdk_event_check (gpointer source_data,
+ GTimeVal *current_time);
+static gboolean gdk_event_dispatch (gpointer source_data,
+ GTimeVal *current_time,
+ gpointer user_data);
-static void gdk_synthesize_click (GdkEvent *event,
- gint nclicks);
+static void gdk_synthesize_click (GdkEvent *event,
+ gint nclicks);
GdkFilterReturn gdk_wm_protocols_filter (GdkXEvent *xev,
GdkEvent *event,
@@ -111,11 +114,11 @@ static GdkWindow *button_window[2]; /* The last 2 windows to receive button
*/
static guint button_number[2]; /* The last 2 buttons to be pressed.
*/
-static GdkEventFunc event_func; /* Callback for events */
-static gpointer event_data;
-static GDestroyNotify event_notify;
+static GdkEventFunc event_func = NULL; /* Callback for events */
+static gpointer event_data = NULL;
+static GDestroyNotify event_notify = NULL;
-static GList *client_filters; /* Filters for client messages */
+static GList *client_filters; /* Filters for client messages */
/* FIFO's for event queue, and for events put back using
* gdk_event_put().
@@ -146,7 +149,7 @@ GPollFD event_poll_fd;
* Pointer to the list node for that event, or NULL
*************************************************************/
-static GList *
+static GList*
gdk_event_queue_find_first (void)
{
GList *tmp_list = queued_events;
@@ -197,7 +200,7 @@ gdk_event_queue_remove_link (GList *node)
static void
gdk_event_queue_append (GdkEvent *event)
{
- queued_tail = g_list_append(queued_tail, event);
+ queued_tail = g_list_append (queued_tail, event);
if (!queued_events)
queued_events = queued_tail;
@@ -269,23 +272,23 @@ gdk_events_pending (void)
*-------------------------------------------------------------- */
static Bool
-graphics_expose_predicate (Display *display,
- XEvent *xevent,
- XPointer arg)
+graphics_expose_predicate (Display *display,
+ XEvent *xevent,
+ XPointer arg)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)arg;
+ GdkWindowPrivate *private = (GdkWindowPrivate*) arg;
g_return_val_if_fail (private != NULL, False);
- if ((xevent->xany.window == private->xwindow) &&
- ((xevent->xany.type == GraphicsExpose) ||
- (xevent->xany.type == NoExpose)))
+ if (xevent->xany.window == private->xwindow &&
+ (xevent->xany.type == GraphicsExpose ||
+ xevent->xany.type == NoExpose))
return True;
else
return False;
}
-GdkEvent *
+GdkEvent*
gdk_event_get_graphics_expose (GdkWindow *window)
{
XEvent xevent;
@@ -293,7 +296,7 @@ gdk_event_get_graphics_expose (GdkWindow *window)
g_return_val_if_fail (window != NULL, NULL);
- XIfEvent (gdk_display, &xevent, graphics_expose_predicate, (XPointer)window);
+ XIfEvent (gdk_display, &xevent, graphics_expose_predicate, (XPointer) window);
if (xevent.xany.type == GraphicsExpose)
{
@@ -368,15 +371,18 @@ gdk_add_rect_to_rects (GdkRectangle *rect1,
typedef struct _GdkExposeInfo GdkExposeInfo;
-struct _GdkExposeInfo {
+struct _GdkExposeInfo
+{
Window window;
gboolean seen_nonmatching;
};
-Bool
-expose_predicate (Display *display, XEvent *xevent, XPointer arg)
+static Bool
+expose_predicate (Display *display,
+ XEvent *xevent,
+ XPointer arg)
{
- GdkExposeInfo *info = (GdkExposeInfo *)arg;
+ GdkExposeInfo *info = (GdkExposeInfo*) arg;
/* Compressing across GravityNotify events is safe, because
* we completely ignore them, so they can't change what
@@ -385,22 +391,23 @@ expose_predicate (Display *display, XEvent *xevent, XPointer arg)
* we'll get a whole bunch of them interspersed with
* expose events.
*/
- if ((xevent->xany.type != Expose) &&
- (xevent->xany.type != GravityNotify))
+ if (xevent->xany.type != Expose &&
+ xevent->xany.type != GravityNotify)
{
info->seen_nonmatching = TRUE;
}
if (info->seen_nonmatching ||
- (xevent->xany.type != Expose) ||
- (xevent->xany.window != info->window))
+ xevent->xany.type != Expose ||
+ xevent->xany.window != info->window)
return FALSE;
else
return TRUE;
}
void
-gdk_compress_exposures (XEvent *xevent, GdkWindow *window)
+gdk_compress_exposures (XEvent *xevent,
+ GdkWindow *window)
{
gint nrects = 1;
gint count = 0;
@@ -522,7 +529,7 @@ gdk_event_handler_set (GdkEventFunc func,
gpointer data,
GDestroyNotify notify)
{
- if (event_func && event_notify)
+ if (event_notify)
(*event_notify) (event_data);
event_func = func;
@@ -548,12 +555,12 @@ gdk_event_handler_set (GdkEventFunc func,
*--------------------------------------------------------------
*/
-GdkEvent *
+GdkEvent*
gdk_event_get (void)
{
- gdk_events_queue();
+ gdk_events_queue ();
- return gdk_event_unqueue();
+ return gdk_event_unqueue ();
}
/*
@@ -575,7 +582,7 @@ gdk_event_get (void)
*--------------------------------------------------------------
*/
-GdkEvent *
+GdkEvent*
gdk_event_peek (void)
{
GList *tmp_list;
@@ -618,7 +625,7 @@ gdk_event_put (GdkEvent *event)
*--------------------------------------------------------------
*/
-static GMemChunk *event_chunk;
+static GMemChunk *event_chunk = NULL;
static GdkEvent*
gdk_event_new (void)
@@ -634,7 +641,7 @@ gdk_event_new (void)
new_event = g_chunk_new (GdkEventPrivate, event_chunk);
new_event->flags = 0;
- return (GdkEvent *)new_event;
+ return (GdkEvent*) new_event;
}
GdkEvent*
@@ -670,7 +677,6 @@ gdk_event_copy (GdkEvent *event)
case GDK_DROP_FINISHED:
gdk_drag_context_ref (event->dnd.context);
break;
-
default:
break;
@@ -700,8 +706,9 @@ gdk_event_copy (GdkEvent *event)
void
gdk_event_free (GdkEvent *event)
{
- g_assert (event_chunk != NULL);
g_return_if_fail (event != NULL);
+
+ g_assert (event_chunk != NULL); /* paranoid */
if (event->any.window)
gdk_window_unref (event->any.window);
@@ -727,7 +734,6 @@ gdk_event_free (GdkEvent *event)
case GDK_DROP_FINISHED:
gdk_drag_context_unref (event->dnd.context);
break;
-
default:
break;
@@ -811,7 +817,7 @@ gdk_event_get_time (GdkEvent *event)
*/
void
-gdk_set_show_events (int show_events)
+gdk_set_show_events (gint show_events)
{
if (show_events)
gdk_debug_flags |= GDK_DEBUG_EVENTS;
@@ -882,9 +888,9 @@ gdk_input_add_full (gint source,
cond |= G_IO_ERR|G_IO_HUP|G_IO_NVAL;
channel = g_io_channel_unix_new (source);
- result = g_io_add_watch_full (channel, G_PRIORITY_DEFAULT, cond,
- gdk_io_invoke,
- closure, gdk_io_destroy);
+ result = g_io_add_watch_full (channel, G_PRIORITY_DEFAULT, cond,
+ gdk_io_invoke,
+ closure, gdk_io_destroy);
g_io_channel_unref (channel);
return result;
@@ -918,9 +924,9 @@ gdk_event_apply_filters (XEvent *xevent,
while (tmp_list)
{
- filter = (GdkEventFilter *)tmp_list->data;
+ filter = (GdkEventFilter*) tmp_list->data;
- result = (*filter->function)(xevent, event, filter->data);
+ result = (*filter->function) (xevent, event, filter->data);
if (result != GDK_FILTER_CONTINUE)
return result;
@@ -2020,8 +2026,8 @@ gdk_event_prepare (gpointer source_data,
}
static gboolean
-gdk_event_check (gpointer source_data,
- GTimeVal *current_time)
+gdk_event_check (gpointer source_data,
+ GTimeVal *current_time)
{
gboolean retval;
@@ -2037,7 +2043,7 @@ gdk_event_check (gpointer source_data,
return retval;
}
-static GdkEvent *
+static GdkEvent*
gdk_event_unqueue (void)
{
GdkEvent *event = NULL;
@@ -2215,7 +2221,8 @@ gdk_event_send_clientmessage_toall (GdkEvent *event)
*--------------------------------------------------------------
*/
-void gdk_flush (void)
+void
+gdk_flush (void)
{
XSync (gdk_display, False);
}
diff --git a/gdk/gdkrectangle.c b/gdk/gdkrectangle.c
index e1d1d300f..04017a99e 100644
--- a/gdk/gdkrectangle.c
+++ b/gdk/gdkrectangle.c
@@ -25,12 +25,14 @@ gdk_rectangle_union (GdkRectangle *src1,
GdkRectangle *src2,
GdkRectangle *dest)
{
+ g_return_if_fail (src1 != NULL);
+ g_return_if_fail (src2 != NULL);
+ g_return_if_fail (dest != NULL);
+
dest->x = MIN (src1->x, src2->x);
dest->y = MIN (src1->y, src2->y);
- dest->width =
- MAX (src1->x + src1->width, src2->x + src2->width) - dest->x;
- dest->height =
- MAX (src1->y + src1->height, src2->y + src2->height) - dest->y;
+ dest->width = MAX (src1->x + src1->width, src2->x + src2->width) - dest->x;
+ dest->height = MAX (src1->y + src1->height, src2->y + src2->height) - dest->y;
}
gint
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index e6695e242..e941db46f 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -67,7 +67,7 @@ const int gdk_event_mask_table[20] =
0, /* PROXIMTY_OUT */
SubstructureNotifyMask
};
-const int gdk_nevent_masks = sizeof(gdk_event_mask_table)/sizeof(int);
+const int gdk_nevent_masks = sizeof (gdk_event_mask_table) / sizeof (int);
/* Forward declarations */
static gboolean gdk_window_gravity_works (void);
@@ -85,50 +85,50 @@ gdk_window_xid_at (Window base,
GList *excludes,
gboolean excl_child)
{
- GdkWindow *window;
- GdkWindowPrivate *private;
- Display *disp;
- Window *list = NULL;
- Window child = 0, parent_win = 0, root_win = 0;
- int i;
- unsigned int ww, wh, wb, wd, num;
- int wx, wy;
-
- window = (GdkWindow*) &gdk_root_parent;
- private = (GdkWindowPrivate*) window;
- disp = private->xdisplay;
- if (!XGetGeometry (disp, base, &root_win, &wx, &wy, &ww, &wh, &wb, &wd))
- return 0;
- wx += bx;
- wy += by;
-
- if (!((x >= wx) &&
- (y >= wy) &&
- (x < (int) (wx + ww)) &&
- (y < (int) (wy + wh))))
- return 0;
-
- if (!XQueryTree (disp, base, &root_win, &parent_win, &list, &num))
- return base;
-
- if (list)
- {
- for (i = num - 1; ; i--)
- {
- if ((!excl_child) || (!g_list_find (excludes, (gpointer *) list[i])))
- {
- if ((child = gdk_window_xid_at (list[i], wx, wy, x, y, excludes, excl_child)) != 0)
- {
- XFree (list);
- return child;
- }
- }
- if (!i)
- break;
- }
- XFree (list);
- }
- return base;
+ GdkWindow *window;
+ GdkWindowPrivate *private;
+ Display *disp;
+ Window *list = NULL;
+ Window child = 0, parent_win = 0, root_win = 0;
+ int i;
+ unsigned int ww, wh, wb, wd, num;
+ int wx, wy;
+
+ window = (GdkWindow*) &gdk_root_parent;
+ private = (GdkWindowPrivate*) window;
+ disp = private->xdisplay;
+ if (!XGetGeometry (disp, base, &root_win, &wx, &wy, &ww, &wh, &wb, &wd))
+ return 0;
+ wx += bx;
+ wy += by;
+
+ if (!((x >= wx) &&
+ (y >= wy) &&
+ (x < (int) (wx + ww)) &&
+ (y < (int) (wy + wh))))
+ return 0;
+
+ if (!XQueryTree (disp, base, &root_win, &parent_win, &list, &num))
+ return base;
+
+ if (list)
+ {
+ for (i = num - 1; ; i--)
+ {
+ if ((!excl_child) || (!g_list_find (excludes, (gpointer *) list[i])))
+ {
+ if ((child = gdk_window_xid_at (list[i], wx, wy, x, y, excludes, excl_child)) != 0)
+ {
+ XFree (list);
+ return child;
+ }
+ }
+ if (!i)
+ break;
+ }
+ XFree (list);
+ }
+ return base;
}
/*
@@ -150,64 +150,64 @@ gdk_window_xid_at_coords (gint x,
GList *excludes,
gboolean excl_child)
{
- GdkWindow *window;
- GdkWindowPrivate *private;
- Display *disp;
- Window *list = NULL;
- Window root, child = 0, parent_win = 0, root_win = 0;
- unsigned int num;
- int i;
-
- window = (GdkWindow*) &gdk_root_parent;
- private = (GdkWindowPrivate*) window;
- disp = private->xdisplay;
- root = private->xwindow;
- num = g_list_length (excludes);
-
- XGrabServer (disp);
- if (!XQueryTree (disp, root, &root_win, &parent_win, &list, &num))
- {
- XUngrabServer(disp);
- return root;
- }
- if (list)
- {
- i = num - 1;
- do
- {
- XWindowAttributes xwa;
-
- XGetWindowAttributes (disp, list [i], &xwa);
-
- if (xwa.map_state != IsViewable)
- continue;
-
- if (excl_child && g_list_find (excludes, (gpointer *) list[i]))
- continue;
-
- if ((child = gdk_window_xid_at (list[i], 0, 0, x, y, excludes, excl_child)) == 0)
- continue;
-
- if (excludes)
- {
- if (!g_list_find (excludes, (gpointer *) child))
- {
- XFree (list);
- XUngrabServer (disp);
- return child;
- }
- }
- else
- {
- XFree (list);
- XUngrabServer (disp);
- return child;
- }
- } while (--i > 0);
- XFree (list);
- }
- XUngrabServer (disp);
- return root;
+ GdkWindow *window;
+ GdkWindowPrivate *private;
+ Display *disp;
+ Window *list = NULL;
+ Window root, child = 0, parent_win = 0, root_win = 0;
+ unsigned int num;
+ int i;
+
+ window = (GdkWindow*) &gdk_root_parent;
+ private = (GdkWindowPrivate*) window;
+ disp = private->xdisplay;
+ root = private->xwindow;
+ num = g_list_length (excludes);
+
+ XGrabServer (disp);
+ if (!XQueryTree (disp, root, &root_win, &parent_win, &list, &num))
+ {
+ XUngrabServer (disp);
+ return root;
+ }
+ if (list)
+ {
+ i = num - 1;
+ do
+ {
+ XWindowAttributes xwa;
+
+ XGetWindowAttributes (disp, list [i], &xwa);
+
+ if (xwa.map_state != IsViewable)
+ continue;
+
+ if (excl_child && g_list_find (excludes, (gpointer *) list[i]))
+ continue;
+
+ if ((child = gdk_window_xid_at (list[i], 0, 0, x, y, excludes, excl_child)) == 0)
+ continue;
+
+ if (excludes)
+ {
+ if (!g_list_find (excludes, (gpointer *) child))
+ {
+ XFree (list);
+ XUngrabServer (disp);
+ return child;
+ }
+ }
+ else
+ {
+ XFree (list);
+ XUngrabServer (disp);
+ return child;
+ }
+ } while (--i > 0);
+ XFree (list);
+ }
+ XUngrabServer (disp);
+ return root;
}
void
@@ -219,11 +219,11 @@ gdk_window_init (void)
unsigned int border_width;
unsigned int depth;
int x, y;
-
+
XGetGeometry (gdk_display, gdk_root_window, &gdk_root_window,
&x, &y, &width, &height, &border_width, &depth);
XGetWindowAttributes (gdk_display, gdk_root_window, &xattributes);
-
+
gdk_root_parent.xwindow = gdk_root_window;
gdk_root_parent.xdisplay = gdk_display;
gdk_root_parent.window_type = GDK_WINDOW_ROOT;
@@ -233,7 +233,7 @@ gdk_window_init (void)
gdk_root_parent.children = NULL;
gdk_root_parent.colormap = NULL;
gdk_root_parent.ref_count = 1;
-
+
gdk_xid_table_insert (&gdk_root_window, &gdk_root_parent);
}
@@ -260,24 +260,24 @@ gdk_window_new (GdkWindow *parent,
unsigned int class;
char *title;
int i;
-
+
g_return_val_if_fail (attributes != NULL, NULL);
-
+
if (!parent)
parent = (GdkWindow*) &gdk_root_parent;
-
+
parent_private = (GdkWindowPrivate*) parent;
if (parent_private->destroyed)
return NULL;
-
+
xparent = parent_private->xwindow;
parent_display = parent_private->xdisplay;
-
+
private = g_new (GdkWindowPrivate, 1);
window = (GdkWindow*) private;
-
+
private->parent = parent;
-
+
private->xdisplay = parent_display;
private->destroyed = FALSE;
private->mapped = FALSE;
@@ -285,106 +285,106 @@ gdk_window_new (GdkWindow *parent,
private->resize_count = 0;
private->ref_count = 1;
xattributes_mask = 0;
-
+
if (attributes_mask & GDK_WA_X)
x = attributes->x;
else
x = 0;
-
+
if (attributes_mask & GDK_WA_Y)
y = attributes->y;
else
y = 0;
-
+
private->x = x;
private->y = y;
private->width = (attributes->width > 1) ? (attributes->width) : (1);
private->height = (attributes->height > 1) ? (attributes->height) : (1);
private->window_type = attributes->window_type;
private->extension_events = FALSE;
-
+
private->filters = NULL;
private->children = NULL;
-
+
window->user_data = NULL;
-
+
if (attributes_mask & GDK_WA_VISUAL)
visual = attributes->visual;
else
visual = gdk_visual_get_system ();
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
-
+
xattributes.event_mask = StructureNotifyMask;
for (i = 0; i < gdk_nevent_masks; i++)
{
if (attributes->event_mask & (1 << (i + 1)))
xattributes.event_mask |= gdk_event_mask_table[i];
}
-
+
if (xattributes.event_mask)
xattributes_mask |= CWEventMask;
-
+
if (attributes_mask & GDK_WA_NOREDIR)
{
xattributes.override_redirect =
- (attributes->override_redirect == FALSE)?False:True;
+ (attributes->override_redirect == FALSE)?False:True;
xattributes_mask |= CWOverrideRedirect;
}
else
xattributes.override_redirect = False;
-
+
if (parent_private && parent_private->guffaw_gravity)
{
xattributes.win_gravity = StaticGravity;
xattributes_mask |= CWWinGravity;
}
-
+
if (attributes->wclass == GDK_INPUT_OUTPUT)
{
class = InputOutput;
depth = visual->depth;
-
+
if (attributes_mask & GDK_WA_COLORMAP)
private->colormap = attributes->colormap;
else
{
- if ((((GdkVisualPrivate*)gdk_visual_get_system())->xvisual) == xvisual)
+ if ((((GdkVisualPrivate*)gdk_visual_get_system ())->xvisual) == xvisual)
private->colormap = gdk_colormap_get_system ();
else
private->colormap = gdk_colormap_new (visual, False);
}
-
+
xattributes.background_pixel = BlackPixel (gdk_display, gdk_screen);
xattributes.border_pixel = BlackPixel (gdk_display, gdk_screen);
xattributes_mask |= CWBorderPixel | CWBackPixel;
-
+
switch (private->window_type)
{
case GDK_WINDOW_TOPLEVEL:
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
xattributes_mask |= CWColormap;
-
+
xparent = gdk_root_window;
break;
-
+
case GDK_WINDOW_CHILD:
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
xattributes_mask |= CWColormap;
break;
-
+
case GDK_WINDOW_DIALOG:
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
xattributes_mask |= CWColormap;
-
+
xparent = gdk_root_window;
break;
-
+
case GDK_WINDOW_TEMP:
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
xattributes_mask |= CWColormap;
-
+
xparent = gdk_root_window;
-
+
xattributes.save_under = True;
xattributes.override_redirect = True;
xattributes.cursor = None;
@@ -404,24 +404,24 @@ gdk_window_new (GdkWindow *parent,
class = InputOnly;
private->colormap = NULL;
}
-
+
private->xwindow = XCreateWindow (private->xdisplay, xparent,
x, y, private->width, private->height,
0, depth, class, xvisual,
xattributes_mask, &xattributes);
gdk_window_ref (window);
gdk_xid_table_insert (&private->xwindow, window);
-
+
if (private->colormap)
gdk_colormap_ref (private->colormap);
-
+
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) :
NULL));
-
+
if (parent_private)
parent_private->children = g_list_prepend (parent_private->children, window);
-
+
switch (private->window_type)
{
case GDK_WINDOW_DIALOG:
@@ -438,48 +438,48 @@ gdk_window_new (GdkWindow *parent,
GDK_NOTE (MISC, g_message ("adding colormap window\n"));
gdk_window_add_colormap_windows (window);
}
-
+
return window;
default:
-
+
return window;
}
-
+
size_hints.flags = PSize;
size_hints.width = private->width;
size_hints.height = private->height;
-
+
wm_hints.flags = InputHint | StateHint | WindowGroupHint;
wm_hints.window_group = gdk_leader_window;
wm_hints.input = True;
wm_hints.initial_state = NormalState;
-
+
/* FIXME: Is there any point in doing this? Do any WM's pay
* attention to PSize, and even if they do, is this the
* correct value???
*/
XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
-
+
XSetWMHints (private->xdisplay, private->xwindow, &wm_hints);
-
+
if (!wm_client_leader_atom)
- wm_client_leader_atom = gdk_atom_intern ("WM_CLIENT_LEADER", FALSE);
-
+ wm_client_leader_atom = gdk_atom_intern ("WM_CLIENT_LEADER", FALSE);
+
XChangeProperty (private->xdisplay, private->xwindow,
wm_client_leader_atom,
XA_WINDOW, 32, PropModeReplace,
(guchar*) &gdk_leader_window, 1);
-
+
if (attributes_mask & GDK_WA_TITLE)
title = attributes->title;
else
title = g_get_prgname ();
-
+
XmbSetWMProperties (private->xdisplay, private->xwindow,
title, title,
NULL, 0,
NULL, NULL, NULL);
-
+
if (attributes_mask & GDK_WA_WMCLASS)
{
class_hint = XAllocClassHint ();
@@ -488,8 +488,8 @@ gdk_window_new (GdkWindow *parent,
XSetClassHint (private->xdisplay, private->xwindow, class_hint);
XFree (class_hint);
}
-
-
+
+
return window;
}
@@ -503,28 +503,28 @@ gdk_window_foreign_new (guint32 anid)
Window root, parent;
Window *children = NULL;
guint nchildren;
-
- if(!XGetWindowAttributes (gdk_display, anid, &attrs)) {
- g_warning("XGetWindowAttributes failed on window ID %d\n", anid);
+
+ if (!XGetWindowAttributes (gdk_display, anid, &attrs)) {
+ g_warning ("XGetWindowAttributes failed on window ID %d\n", anid);
return NULL;
}
-
+
private = g_new (GdkWindowPrivate, 1);
window = (GdkWindow*) private;
-
+
/* FIXME: This is pretty expensive. Maybe the caller should supply
* the parent */
XQueryTree (gdk_display, anid, &root, &parent, &children, &nchildren);
-
+
if (children)
XFree (children);
private->parent = gdk_xid_table_lookup (parent);
-
+
parent_private = (GdkWindowPrivate *)private->parent;
if (parent_private)
parent_private->children = g_list_prepend (parent_private->children, window);
-
+
private->xwindow = anid;
private->xdisplay = gdk_display;
private->x = attrs.x;
@@ -538,17 +538,17 @@ gdk_window_foreign_new (guint32 anid)
private->mapped = (attrs.map_state != IsUnmapped);
private->guffaw_gravity = FALSE;
private->extension_events = 0;
-
+
private->colormap = NULL;
-
+
private->filters = NULL;
private->children = NULL;
-
+
window->user_data = NULL;
-
+
gdk_window_ref (window);
gdk_xid_table_insert (&private->xwindow, window);
-
+
return window;
}
@@ -568,11 +568,11 @@ gdk_window_internal_destroy (GdkWindow *window,
GdkWindow *temp_window;
GList *children;
GList *tmp;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
-
+
switch (private->window_type)
{
case GDK_WINDOW_TOPLEVEL:
@@ -588,12 +588,12 @@ gdk_window_internal_destroy (GdkWindow *window,
if (parent_private->children)
parent_private->children = g_list_remove (parent_private->children, window);
}
-
+
if (private->window_type != GDK_WINDOW_FOREIGN)
{
children = tmp = private->children;
private->children = NULL;
-
+
while (tmp)
{
temp_window = tmp->data;
@@ -604,23 +604,23 @@ gdk_window_internal_destroy (GdkWindow *window,
gdk_window_internal_destroy (temp_window, FALSE,
our_destroy);
}
-
+
g_list_free (children);
}
-
+
if (private->extension_events != 0)
gdk_input_window_destroy (window);
-
+
if (private->filters)
{
tmp = private->filters;
-
+
while (tmp)
{
g_free (tmp->data);
tmp = tmp->next;
}
-
+
g_list_free (private->filters);
private->filters = NULL;
}
@@ -651,19 +651,19 @@ gdk_window_internal_destroy (GdkWindow *window,
}
else if (xdestroy)
XDestroyWindow (private->xdisplay, private->xwindow);
-
+
if (private->colormap)
gdk_colormap_unref (private->colormap);
-
+
private->mapped = FALSE;
private->destroyed = TRUE;
}
break;
-
+
case GDK_WINDOW_ROOT:
g_error ("attempted to destroy root window");
break;
-
+
case GDK_WINDOW_PIXMAP:
g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)");
break;
@@ -686,11 +686,11 @@ void
gdk_window_destroy_notify (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
-
+
if (!private->destroyed)
{
if (private->window_type == GDK_WINDOW_FOREIGN)
@@ -708,7 +708,7 @@ gdk_window_ref (GdkWindow *window)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
g_return_val_if_fail (window != NULL, NULL);
-
+
private->ref_count += 1;
return window;
}
@@ -718,7 +718,7 @@ gdk_window_unref (GdkWindow *window)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
g_return_if_fail (window != NULL);
-
+
private->ref_count -= 1;
if (private->ref_count == 0)
{
@@ -738,9 +738,9 @@ void
gdk_window_show (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
{
@@ -754,9 +754,9 @@ void
gdk_window_hide (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
{
@@ -769,9 +769,9 @@ void
gdk_window_withdraw (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
XWithdrawWindow (private->xdisplay, private->xwindow, 0);
@@ -783,9 +783,9 @@ gdk_window_move (GdkWindow *window,
gint y)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
{
@@ -805,16 +805,16 @@ gdk_window_resize (GdkWindow *window,
gint height)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
if (width < 1)
width = 1;
if (height < 1)
height = 1;
-
+
private = (GdkWindowPrivate*) window;
-
+
if (!private->destroyed &&
((private->resize_count > 0) ||
(private->width != (guint16) width) ||
@@ -822,7 +822,7 @@ gdk_window_resize (GdkWindow *window,
{
XResizeWindow (private->xdisplay, private->xwindow, width, height);
private->resize_count += 1;
-
+
if (private->window_type == GDK_WINDOW_CHILD)
{
private->width = width;
@@ -839,14 +839,14 @@ gdk_window_move_resize (GdkWindow *window,
gint height)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
if (width < 1)
width = 1;
if (height < 1)
height = 1;
-
+
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
{
@@ -858,7 +858,7 @@ gdk_window_move_resize (GdkWindow *window,
while (tmp_list)
{
GdkWindowPrivate *child_private = tmp_list->data;
-
+
child_private->x -= x - private->x;
child_private->y -= y - private->y;
@@ -885,27 +885,27 @@ gdk_window_reparent (GdkWindow *window,
GdkWindowPrivate *window_private;
GdkWindowPrivate *parent_private;
GdkWindowPrivate *old_parent_private;
-
+
g_return_if_fail (window != NULL);
-
+
if (!new_parent)
new_parent = (GdkWindow*) &gdk_root_parent;
-
+
window_private = (GdkWindowPrivate*) window;
old_parent_private = (GdkWindowPrivate*)window_private->parent;
parent_private = (GdkWindowPrivate*) new_parent;
-
+
if (!window_private->destroyed && !parent_private->destroyed)
XReparentWindow (window_private->xdisplay,
window_private->xwindow,
parent_private->xwindow,
x, y);
-
+
window_private->parent = new_parent;
-
+
if (old_parent_private)
old_parent_private->children = g_list_remove (old_parent_private->children, window);
-
+
if ((old_parent_private &&
(!old_parent_private->guffaw_gravity != !parent_private->guffaw_gravity)) ||
(!old_parent_private && parent_private->guffaw_gravity))
@@ -918,11 +918,11 @@ void
gdk_window_clear (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
-
+
if (!private->destroyed)
XClearWindow (private->xdisplay, private->xwindow);
}
@@ -1178,11 +1178,11 @@ gdk_window_set_role (GdkWindow *window,
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
-
+
if (role)
XChangeProperty (private->xdisplay, private->xwindow,
gdk_atom_intern ("WM_WINDOW_ROLE", FALSE), XA_STRING,
- 8, PropModeReplace, role, strlen(role));
+ 8, PropModeReplace, role, strlen (role));
else
XDeleteProperty (private->xdisplay, private->xwindow,
gdk_atom_intern ("WM_WINDOW_ROLE", FALSE));
@@ -1199,7 +1199,7 @@ gdk_window_set_transient_for (GdkWindow *window,
private = (GdkWindowPrivate*) window;
parent_private = (GdkWindowPrivate*) parent;
-
+
if (!private->destroyed && !parent_private->destroyed)
XSetTransientForHint (private->xdisplay,
private->xwindow, parent_private->xwindow);
@@ -1284,7 +1284,7 @@ gdk_window_set_colormap (GdkWindow *window,
XSetWindowColormap (window_private->xdisplay,
window_private->xwindow,
colormap_private->xcolormap);
-
+
if (window_private->colormap)
gdk_colormap_unref (window_private->colormap);
window_private->colormap = colormap;
@@ -1383,9 +1383,9 @@ gdk_window_get_visual (GdkWindow *window)
{
GdkWindowPrivate *window_private;
XWindowAttributes window_attributes;
-
+
g_return_val_if_fail (window != NULL, NULL);
-
+
window_private = (GdkWindowPrivate*) window;
/* Huh? ->parent is never set for a pixmap. We should just return
* null immeditately
@@ -1395,15 +1395,15 @@ gdk_window_get_visual (GdkWindow *window)
if (window_private && !window_private->destroyed)
{
- if (window_private->colormap == NULL)
- {
- XGetWindowAttributes (window_private->xdisplay,
- window_private->xwindow,
- &window_attributes);
- return gdk_visual_lookup (window_attributes.visual);
- }
- else
- return ((GdkColormapPrivate *)window_private->colormap)->visual;
+ if (window_private->colormap == NULL)
+ {
+ XGetWindowAttributes (window_private->xdisplay,
+ window_private->xwindow,
+ &window_attributes);
+ return gdk_visual_lookup (window_attributes.visual);
+ }
+ else
+ return ((GdkColormapPrivate *)window_private->colormap)->visual;
}
return NULL;
@@ -1417,7 +1417,7 @@ gdk_window_get_colormap (GdkWindow *window)
g_return_val_if_fail (window != NULL, NULL);
window_private = (GdkWindowPrivate*) window;
-
+
g_return_val_if_fail (window_private->window_type != GDK_WINDOW_PIXMAP, NULL);
if (!window_private->destroyed)
{
@@ -1427,9 +1427,9 @@ gdk_window_get_colormap (GdkWindow *window)
window_private->xwindow,
&window_attributes);
return gdk_colormap_lookup (window_attributes.colormap);
- }
- else
- return window_private->colormap;
+ }
+ else
+ return window_private->colormap;
}
return NULL;
@@ -1439,9 +1439,9 @@ GdkWindowType
gdk_window_get_type (GdkWindow *window)
{
GdkWindowPrivate *window_private;
-
+
g_return_val_if_fail (window != NULL, (GdkWindowType) -1);
-
+
window_private = (GdkWindowPrivate*) window;
return window_private->window_type;
}
@@ -1456,11 +1456,11 @@ gdk_window_get_origin (GdkWindow *window,
Window child;
gint tx = 0;
gint ty = 0;
-
+
g_return_val_if_fail (window != NULL, 0);
-
+
private = (GdkWindowPrivate*) window;
-
+
if (!private->destroyed)
{
return_val = XTranslateCoordinates (private->xdisplay,
@@ -1498,40 +1498,40 @@ gdk_window_get_deskrelative_origin (GdkWindow *window,
guchar *data_return;
g_return_val_if_fail (window != NULL, 0);
-
+
private = (GdkWindowPrivate*) window;
-
+
if (!private->destroyed)
{
if (!atom)
- atom = XInternAtom(private->xdisplay, "ENLIGHTENMENT_DESKTOP", False);
+ atom = XInternAtom (private->xdisplay, "ENLIGHTENMENT_DESKTOP", False);
win = private->xwindow;
-
- while (XQueryTree(private->xdisplay, win, &root, &parent,
- &child, (unsigned int *)&num_children))
+
+ while (XQueryTree (private->xdisplay, win, &root, &parent,
+ &child, (unsigned int *)&num_children))
{
if ((child) && (num_children > 0))
- XFree(child);
-
+ XFree (child);
+
if (!parent)
break;
else
win = parent;
-
+
if (win == root)
break;
data_return = NULL;
- XGetWindowProperty(private->xdisplay, win, atom, 0, 0,
- False, XA_CARDINAL, &type_return, &format_return,
- &number_return, &bytes_after_return, &data_return);
+ XGetWindowProperty (private->xdisplay, win, atom, 0, 0,
+ False, XA_CARDINAL, &type_return, &format_return,
+ &number_return, &bytes_after_return, &data_return);
if (type_return == XA_CARDINAL)
{
- XFree(data_return);
+ XFree (data_return);
break;
}
}
-
+
return_val = XTranslateCoordinates (private->xdisplay,
private->xwindow,
win,
@@ -1542,7 +1542,7 @@ gdk_window_get_deskrelative_origin (GdkWindow *window,
if (y)
*y = ty;
}
-
+
return return_val;
}
@@ -1558,9 +1558,9 @@ gdk_window_get_root_origin (GdkWindow *window,
Window root;
Window *children;
unsigned int nchildren;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
if (x)
*x = 0;
@@ -1568,12 +1568,12 @@ gdk_window_get_root_origin (GdkWindow *window,
*y = 0;
if (private->destroyed)
return;
-
+
while (private->parent && ((GdkWindowPrivate*) private->parent)->parent)
private = (GdkWindowPrivate*) private->parent;
if (private->destroyed)
return;
-
+
xparent = private->xwindow;
do
{
@@ -1582,17 +1582,17 @@ gdk_window_get_root_origin (GdkWindow *window,
&root, &xparent,
&children, &nchildren))
return;
-
+
if (children)
XFree (children);
}
while (xparent != root);
-
+
if (xparent == root)
{
unsigned int ww, wh, wb, wd;
int wx, wy;
-
+
if (XGetGeometry (private->xdisplay, xwindow, &root, &wx, &wy, &ww, &wh, &wb, &wd))
{
if (x)
@@ -1617,12 +1617,12 @@ gdk_window_get_pointer (GdkWindow *window,
int winx = 0;
int winy = 0;
unsigned int xmask = 0;
-
+
if (!window)
window = (GdkWindow*) &gdk_root_parent;
-
+
private = (GdkWindowPrivate*) window;
-
+
return_val = NULL;
if (!private->destroyed &&
XQueryPointer (private->xdisplay, private->xwindow, &root, &child,
@@ -1654,11 +1654,11 @@ gdk_window_at_pointer (gint *win_x,
int rootx = -1, rooty = -1;
int winx, winy;
unsigned int xmask;
-
+
private = &gdk_root_parent;
-
+
xwindow = private->xwindow;
-
+
XGrabServer (private->xdisplay);
while (xwindow)
{
@@ -1673,12 +1673,12 @@ gdk_window_at_pointer (gint *win_x,
XUngrabServer (private->xdisplay);
window = gdk_window_lookup (xwindow_last);
-
+
if (win_x)
*win_x = window ? winx : -1;
if (win_y)
*win_y = window ? winy : -1;
-
+
return window;
}
@@ -1686,7 +1686,7 @@ GdkWindow*
gdk_window_get_parent (GdkWindow *window)
{
g_return_val_if_fail (window != NULL, NULL);
-
+
return ((GdkWindowPrivate*) window)->parent;
}
@@ -1694,17 +1694,17 @@ GdkWindow*
gdk_window_get_toplevel (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_val_if_fail (window != NULL, NULL);
-
+
private = (GdkWindowPrivate*) window;
-
+
while (private->window_type == GDK_WINDOW_CHILD)
{
window = ((GdkWindowPrivate*) window)->parent;
private = (GdkWindowPrivate*) window;
}
-
+
return window;
}
@@ -1719,18 +1719,18 @@ gdk_window_get_children (GdkWindow *window)
Window *xchildren;
unsigned int nchildren;
unsigned int i;
-
+
g_return_val_if_fail (window != NULL, NULL);
-
+
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return NULL;
-
+
XQueryTree (private->xdisplay, private->xwindow,
&root, &parent, &xchildren, &nchildren);
-
+
children = NULL;
-
+
if (nchildren > 0)
{
for (i = 0; i < nchildren; i++)
@@ -1739,55 +1739,55 @@ gdk_window_get_children (GdkWindow *window)
if (child)
children = g_list_prepend (children, child);
}
-
+
if (xchildren)
XFree (xchildren);
}
-
+
return children;
}
GdkEventMask
-gdk_window_get_events (GdkWindow *window)
+gdk_window_get_events (GdkWindow *window)
{
GdkWindowPrivate *private;
XWindowAttributes attrs;
GdkEventMask event_mask;
int i;
-
+
g_return_val_if_fail (window != NULL, 0);
-
+
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return 0;
-
+
XGetWindowAttributes (gdk_display, private->xwindow,
&attrs);
-
+
event_mask = 0;
for (i = 0; i < gdk_nevent_masks; i++)
{
if (attrs.your_event_mask & gdk_event_mask_table[i])
event_mask |= 1 << (i + 1);
}
-
+
return event_mask;
}
void
-gdk_window_set_events (GdkWindow *window,
- GdkEventMask event_mask)
+gdk_window_set_events (GdkWindow *window,
+ GdkEventMask event_mask)
{
GdkWindowPrivate *private;
long xevent_mask;
int i;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return;
-
+
xevent_mask = StructureNotifyMask;
for (i = 0; i < gdk_nevent_masks; i++)
{
@@ -1808,15 +1808,15 @@ gdk_window_add_colormap_windows (GdkWindow *window)
Window *old_windows;
Window *new_windows;
int i, count;
-
+
g_return_if_fail (window != NULL);
-
+
toplevel = gdk_window_get_toplevel (window);
toplevel_private = (GdkWindowPrivate*) toplevel;
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return;
-
+
old_windows = NULL;
if (!XGetWMColormapWindows (toplevel_private->xdisplay,
toplevel_private->xwindow,
@@ -1824,24 +1824,24 @@ gdk_window_add_colormap_windows (GdkWindow *window)
{
count = 0;
}
-
+
for (i = 0; i < count; i++)
if (old_windows[i] == window_private->xwindow)
{
XFree (old_windows);
return;
}
-
+
new_windows = g_new (Window, count + 1);
-
+
for (i = 0; i < count; i++)
new_windows[i] = old_windows[i];
new_windows[count] = window_private->xwindow;
-
+
XSetWMColormapWindows (toplevel_private->xdisplay,
toplevel_private->xwindow,
new_windows, count + 1);
-
+
g_free (new_windows);
if (old_windows)
XFree (old_windows);
@@ -1852,16 +1852,16 @@ gdk_window_have_shape_ext (void)
{
enum { UNKNOWN, NO, YES };
static gint have_shape = UNKNOWN;
-
+
if (have_shape == UNKNOWN)
{
int ignore;
- if (XQueryExtension(gdk_display, "SHAPE", &ignore, &ignore, &ignore))
+ if (XQueryExtension (gdk_display, "SHAPE", &ignore, &ignore, &ignore))
have_shape = YES;
else
have_shape = NO;
}
-
+
return (have_shape == YES);
}
@@ -1877,15 +1877,15 @@ gdk_window_shape_combine_mask (GdkWindow *window,
{
GdkWindowPrivate *window_private;
Pixmap pixmap;
-
+
g_return_if_fail (window != NULL);
-
+
#ifdef HAVE_SHAPE_EXT
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return;
-
- if (gdk_window_have_shape_ext())
+
+ if (gdk_window_have_shape_ext ())
{
if (mask)
{
@@ -1901,34 +1901,34 @@ gdk_window_shape_combine_mask (GdkWindow *window,
pixmap = None;
}
- XShapeCombineMask (window_private->xdisplay,
- window_private->xwindow,
- ShapeBounding,
- x, y,
- pixmap,
- ShapeSet);
+ XShapeCombineMask (window_private->xdisplay,
+ window_private->xwindow,
+ ShapeBounding,
+ x, y,
+ pixmap,
+ ShapeSet);
}
#endif /* HAVE_SHAPE_EXT */
}
void
-gdk_window_add_filter (GdkWindow *window,
- GdkFilterFunc function,
- gpointer data)
+gdk_window_add_filter (GdkWindow *window,
+ GdkFilterFunc function,
+ gpointer data)
{
GdkWindowPrivate *private;
GList *tmp_list;
GdkEventFilter *filter;
-
+
private = (GdkWindowPrivate*) window;
if (private && private->destroyed)
return;
-
- if(private)
+
+ if (private)
tmp_list = private->filters;
else
tmp_list = gdk_default_filters;
-
+
while (tmp_list)
{
filter = (GdkEventFilter *)tmp_list->data;
@@ -1936,42 +1936,42 @@ gdk_window_add_filter (GdkWindow *window,
return;
tmp_list = tmp_list->next;
}
-
+
filter = g_new (GdkEventFilter, 1);
filter->function = function;
filter->data = data;
-
- if(private)
+
+ if (private)
private->filters = g_list_append (private->filters, filter);
else
gdk_default_filters = g_list_append (gdk_default_filters, filter);
}
void
-gdk_window_remove_filter (GdkWindow *window,
- GdkFilterFunc function,
- gpointer data)
+gdk_window_remove_filter (GdkWindow *window,
+ GdkFilterFunc function,
+ gpointer data)
{
GdkWindowPrivate *private;
GList *tmp_list, *node;
GdkEventFilter *filter;
-
+
private = (GdkWindowPrivate*) window;
-
- if(private)
+
+ if (private)
tmp_list = private->filters;
else
tmp_list = gdk_default_filters;
-
+
while (tmp_list)
{
filter = (GdkEventFilter *)tmp_list->data;
node = tmp_list;
tmp_list = tmp_list->next;
-
+
if ((filter->function == function) && (filter->data == data))
{
- if(private)
+ if (private)
private->filters = g_list_remove_link (private->filters, node);
else
gdk_default_filters = g_list_remove_link (gdk_default_filters, tmp_list);
@@ -1984,39 +1984,39 @@ gdk_window_remove_filter (GdkWindow *window,
}
void
-gdk_window_set_override_redirect(GdkWindow *window,
- gboolean override_redirect)
+gdk_window_set_override_redirect (GdkWindow *window,
+ gboolean override_redirect)
{
GdkWindowPrivate *private;
XSetWindowAttributes attr;
-
+
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return;
-
+
attr.override_redirect = (override_redirect == FALSE)?False:True;
- XChangeWindowAttributes(gdk_display,
- ((GdkWindowPrivate *)window)->xwindow,
- CWOverrideRedirect,
- &attr);
+ XChangeWindowAttributes (gdk_display,
+ ((GdkWindowPrivate *)window)->xwindow,
+ CWOverrideRedirect,
+ &attr);
}
void
-gdk_window_set_icon (GdkWindow *window,
- GdkWindow *icon_window,
- GdkPixmap *pixmap,
- GdkBitmap *mask)
+gdk_window_set_icon (GdkWindow *window,
+ GdkWindow *icon_window,
+ GdkPixmap *pixmap,
+ GdkBitmap *mask)
{
XWMHints wm_hints;
GdkWindowPrivate *window_private;
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return;
-
+
wm_hints.flags = 0;
if (icon_window != NULL)
@@ -2025,32 +2025,32 @@ gdk_window_set_icon (GdkWindow *window,
wm_hints.flags |= IconWindowHint;
wm_hints.icon_window = private->xwindow;
}
-
+
if (pixmap != NULL)
{
private = (GdkWindowPrivate *)pixmap;
wm_hints.flags |= IconPixmapHint;
wm_hints.icon_pixmap = private->xwindow;
}
-
+
if (mask != NULL)
{
private = (GdkWindowPrivate *)mask;
wm_hints.flags |= IconMaskHint;
wm_hints.icon_mask = private->xwindow;
}
-
+
XSetWMHints (window_private->xdisplay, window_private->xwindow, &wm_hints);
}
void
-gdk_window_set_icon_name (GdkWindow *window,
- gchar * name)
+gdk_window_set_icon_name (GdkWindow *window,
+ gchar * name)
{
GdkWindowPrivate *window_private;
XTextProperty property;
gint res;
-
+
g_return_if_fail (window != NULL);
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
@@ -2060,35 +2060,35 @@ gdk_window_set_icon_name (GdkWindow *window,
&property);
if (res < 0)
{
- g_warning("Error converting icon name to text property: %d\n", res);
+ g_warning ("Error converting icon name to text property: %d\n", res);
return;
}
-
+
XSetWMIconName (window_private->xdisplay, window_private->xwindow,
&property);
-
+
if (property.value)
XFree (property.value);
}
void
-gdk_window_set_group (GdkWindow *window,
- GdkWindow *leader)
+gdk_window_set_group (GdkWindow *window,
+ GdkWindow *leader)
{
XWMHints wm_hints;
GdkWindowPrivate *window_private;
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
g_return_if_fail (leader != NULL);
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return;
-
+
private = (GdkWindowPrivate *)leader;
wm_hints.flags = WindowGroupHint;
wm_hints.window_group = private->xwindow;
-
+
XSetWMHints (window_private->xdisplay, window_private->xwindow, &wm_hints);
}
@@ -2102,23 +2102,23 @@ gdk_window_set_mwm_hints (GdkWindow *window,
gint format;
gulong nitems;
gulong bytes_after;
-
+
GdkWindowPrivate *window_private;
-
+
g_return_if_fail (window != NULL);
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return;
-
+
if (!hints_atom)
hints_atom = XInternAtom (window_private->xdisplay,
_XA_MOTIF_WM_HINTS, FALSE);
XGetWindowProperty (window_private->xdisplay, window_private->xwindow,
- hints_atom, 0, sizeof(MotifWmHints)/4,
+ hints_atom, 0, sizeof (MotifWmHints)/4,
False, AnyPropertyType, &type, &format, &nitems,
&bytes_after, (guchar **)&hints);
-
+
if (type == None)
hints = new_hints;
else
@@ -2134,11 +2134,11 @@ gdk_window_set_mwm_hints (GdkWindow *window,
hints->decorations = new_hints->decorations;
}
}
-
+
XChangeProperty (window_private->xdisplay, window_private->xwindow,
hints_atom, hints_atom, 32, PropModeReplace,
- (guchar *)hints, sizeof(MotifWmHints)/4);
-
+ (guchar *)hints, sizeof (MotifWmHints)/4);
+
if (hints != new_hints)
XFree (hints);
}
@@ -2148,10 +2148,10 @@ gdk_window_set_decorations (GdkWindow *window,
GdkWMDecoration decorations)
{
MotifWmHints hints;
-
+
hints.flags = MWM_HINTS_DECORATIONS;
hints.decorations = decorations;
-
+
gdk_window_set_mwm_hints (window, &hints);
}
@@ -2160,10 +2160,10 @@ gdk_window_set_functions (GdkWindow *window,
GdkWMFunction functions)
{
MotifWmHints hints;
-
+
hints.flags = MWM_HINTS_FUNCTIONS;
hints.functions = functions;
-
+
gdk_window_set_mwm_hints (window, &hints);
}
@@ -2172,14 +2172,14 @@ gdk_window_get_toplevels (void)
{
GList *new_list = NULL;
GList *tmp_list;
-
+
tmp_list = gdk_root_parent.children;
while (tmp_list)
{
new_list = g_list_prepend (new_list, tmp_list->data);
tmp_list = tmp_list->next;
}
-
+
return new_list;
}
@@ -2192,147 +2192,154 @@ gdk_window_get_toplevels (void)
struct _gdk_span
{
- gint start;
- gint end;
- struct _gdk_span *next;
+ gint start;
+ gint end;
+ struct _gdk_span *next;
};
static void
-gdk_add_to_span(struct _gdk_span **s, int x, int xx)
-{
- struct _gdk_span *ptr1, *ptr2, *noo, *ss;
- gchar spanning;
-
- ptr2 = NULL;
- ptr1 = *s;
- spanning = 0;
- ss = NULL;
- /* scan the spans for this line */
- while (ptr1)
- {
- /* -- -> new span */
- /* == -> existing span */
- /* ## -> spans intersect */
- /* if we are in the middle of spanning the span into the line */
- if (spanning)
- {
- /* case: ---- ==== */
- if (xx < ptr1->start - 1)
- {
- /* ends before next span - extend to here */
- ss->end = xx;
- return;
- }
- /* case: ----##=== */
- else if (xx <= ptr1->end)
- {
- /* crosses into next span - delete next span and append */
- ss->end = ptr1->end;
- ss->next = ptr1->next;
- g_free(ptr1);
- return;
- }
- /* case: ---###--- */
- else
- {
- /* overlaps next span - delete and keep checking */
- ss->next = ptr1->next;
- g_free(ptr1);
- ptr1 = ss;
- }
- }
- /* otherwise havent started spanning it in yet */
- else
- {
- /* case: ---- ==== */
- if (xx < ptr1->start - 1)
- {
- /* insert span here in list */
- noo = g_malloc(sizeof(struct _gdk_span));
-
- if (noo)
- {
- noo->start = x;
- noo->end = xx;
- noo->next = ptr1;
- if (ptr2)
- ptr2->next = noo;
- else
- *s = noo;
- }
- return;
- }
- /* case: ----##=== */
- else if ((x < ptr1->start) && (xx <= ptr1->end))
- {
- /* expand this span to the left point of the new one */
- ptr1->start = x;
- return;
- }
- /* case: ===###=== */
- else if ((x >= ptr1->start) && (xx <= ptr1->end))
- {
- /* throw the span away */
- return;
- }
- /* case: ---###--- */
- else if ((x < ptr1->start) && (xx > ptr1->end))
- {
- ss = ptr1;
- spanning = 1;
- ptr1->start = x;
- ptr1->end = xx;
- }
- /* case: ===##---- */
- else if ((x >= ptr1->start) && (x <= ptr1->end + 1) && (xx > ptr1->end))
- {
- ss = ptr1;
- spanning = 1;
- ptr1->end = xx;
- }
- /* case: ==== ---- */
- /* case handled by next loop iteration - first case */
- }
- ptr2 = ptr1;
- ptr1 = ptr1->next;
- }
- /* it started in the middle but spans beyond your current list */
- if (spanning)
- {
- ptr2->end = xx;
- return;
- }
- /* it does not start inside a span or in the middle, so add it to the end */
- noo = g_malloc(sizeof(struct _gdk_span));
-
- if (noo)
- {
- noo->start = x;
- noo->end = xx;
- if (ptr2)
- {
- noo->next = ptr2->next;
- ptr2->next = noo;
- }
- else
- {
- noo->next = NULL;
- *s = noo;
- }
- }
- return;
+gdk_add_to_span (struct _gdk_span **s,
+ gint x,
+ gint xx)
+{
+ struct _gdk_span *ptr1, *ptr2, *noo, *ss;
+ gchar spanning;
+
+ ptr2 = NULL;
+ ptr1 = *s;
+ spanning = 0;
+ ss = NULL;
+ /* scan the spans for this line */
+ while (ptr1)
+ {
+ /* -- -> new span */
+ /* == -> existing span */
+ /* ## -> spans intersect */
+ /* if we are in the middle of spanning the span into the line */
+ if (spanning)
+ {
+ /* case: ---- ==== */
+ if (xx < ptr1->start - 1)
+ {
+ /* ends before next span - extend to here */
+ ss->end = xx;
+ return;
+ }
+ /* case: ----##=== */
+ else if (xx <= ptr1->end)
+ {
+ /* crosses into next span - delete next span and append */
+ ss->end = ptr1->end;
+ ss->next = ptr1->next;
+ g_free (ptr1);
+ return;
+ }
+ /* case: ---###--- */
+ else
+ {
+ /* overlaps next span - delete and keep checking */
+ ss->next = ptr1->next;
+ g_free (ptr1);
+ ptr1 = ss;
+ }
+ }
+ /* otherwise havent started spanning it in yet */
+ else
+ {
+ /* case: ---- ==== */
+ if (xx < ptr1->start - 1)
+ {
+ /* insert span here in list */
+ noo = g_malloc (sizeof (struct _gdk_span));
+
+ if (noo)
+ {
+ noo->start = x;
+ noo->end = xx;
+ noo->next = ptr1;
+ if (ptr2)
+ ptr2->next = noo;
+ else
+ *s = noo;
+ }
+ return;
+ }
+ /* case: ----##=== */
+ else if ((x < ptr1->start) && (xx <= ptr1->end))
+ {
+ /* expand this span to the left point of the new one */
+ ptr1->start = x;
+ return;
+ }
+ /* case: ===###=== */
+ else if ((x >= ptr1->start) && (xx <= ptr1->end))
+ {
+ /* throw the span away */
+ return;
+ }
+ /* case: ---###--- */
+ else if ((x < ptr1->start) && (xx > ptr1->end))
+ {
+ ss = ptr1;
+ spanning = 1;
+ ptr1->start = x;
+ ptr1->end = xx;
+ }
+ /* case: ===##---- */
+ else if ((x >= ptr1->start) && (x <= ptr1->end + 1) && (xx > ptr1->end))
+ {
+ ss = ptr1;
+ spanning = 1;
+ ptr1->end = xx;
+ }
+ /* case: ==== ---- */
+ /* case handled by next loop iteration - first case */
+ }
+ ptr2 = ptr1;
+ ptr1 = ptr1->next;
+ }
+ /* it started in the middle but spans beyond your current list */
+ if (spanning)
+ {
+ ptr2->end = xx;
+ return;
+ }
+ /* it does not start inside a span or in the middle, so add it to the end */
+ noo = g_malloc (sizeof (struct _gdk_span));
+
+ if (noo)
+ {
+ noo->start = x;
+ noo->end = xx;
+ if (ptr2)
+ {
+ noo->next = ptr2->next;
+ ptr2->next = noo;
+ }
+ else
+ {
+ noo->next = NULL;
+ *s = noo;
+ }
+ }
+ return;
}
static void
-gdk_add_rectangles (Display *disp, Window win, struct _gdk_span **spans,
- gint basew, gint baseh, gint x, gint y)
+gdk_add_rectangles (Display *disp,
+ Window win,
+ struct _gdk_span **spans,
+ gint basew,
+ gint baseh,
+ gint x,
+ gint y)
{
gint a, k;
gint x1, y1, x2, y2;
gint rn, ord;
XRectangle *rl;
-
- rl = XShapeGetRectangles(disp, win, ShapeBounding, &rn, &ord);
+
+ rl = XShapeGetRectangles (disp, win, ShapeBounding, &rn, &ord);
if (rl)
{
/* go through all clip rects in this window's shape */
@@ -2354,152 +2361,154 @@ gdk_add_rectangles (Display *disp, Window win, struct _gdk_span **spans,
for (a = y1; a <= y2; a++)
{
if ((x2 - x1) >= 0)
- gdk_add_to_span(&spans[a], x1, x2);
+ gdk_add_to_span (&spans[a], x1, x2);
}
}
- XFree(rl);
+ XFree (rl);
}
}
static void
-gdk_propagate_shapes(Display *disp, Window win, gboolean merge)
-{
- Window rt, par, *list = NULL;
- gint i, j, num = 0, num_rects = 0;
- gint x, y, contig;
- guint w, h, d;
- gint baseh, basew;
- XRectangle *rects = NULL;
- struct _gdk_span **spans = NULL, *ptr1, *ptr2, *ptr3;
- XWindowAttributes xatt;
-
- XGetGeometry(disp, win, &rt, &x, &y, &w, &h, &d, &d);
- if (h <= 0)
- return;
- basew = w;
- baseh = h;
- spans = g_malloc(sizeof(struct _gdk_span *) * h);
-
- for (i = 0; i < h; i++)
- spans[i] = NULL;
- XQueryTree(disp, win, &rt, &par, &list, (unsigned int *)&num);
- if (list)
- {
- /* go through all child windows and create/insert spans */
- for (i = 0; i < num; i++)
- {
- if (XGetWindowAttributes(disp, list[i], &xatt) && (xatt.map_state != IsUnmapped))
- if (XGetGeometry(disp, list[i], &rt, &x, &y, &w, &h, &d, &d))
- gdk_add_rectangles (disp, list[i], spans, basew, baseh, x, y);
- }
- if (merge)
- gdk_add_rectangles (disp, win, spans, basew, baseh, x, y);
-
- /* go through the spans list and build a list of rects */
- rects = g_malloc(sizeof(XRectangle) * 256);
- num_rects = 0;
- for (i = 0; i < baseh; i++)
- {
- ptr1 = spans[i];
- /* go through the line for all spans */
- while (ptr1)
- {
- rects[num_rects].x = ptr1->start;
- rects[num_rects].y = i;
- rects[num_rects].width = ptr1->end - ptr1->start + 1;
- rects[num_rects].height = 1;
- j = i + 1;
- /* if there are more lines */
- contig = 1;
- /* while contigous rects (same start/end coords) exist */
- while ((contig) && (j < baseh))
+gdk_propagate_shapes (Display *disp,
+ Window win,
+ gboolean merge)
+{
+ Window rt, par, *list = NULL;
+ gint i, j, num = 0, num_rects = 0;
+ gint x, y, contig;
+ guint w, h, d;
+ gint baseh, basew;
+ XRectangle *rects = NULL;
+ struct _gdk_span **spans = NULL, *ptr1, *ptr2, *ptr3;
+ XWindowAttributes xatt;
+
+ XGetGeometry (disp, win, &rt, &x, &y, &w, &h, &d, &d);
+ if (h <= 0)
+ return;
+ basew = w;
+ baseh = h;
+ spans = g_malloc (sizeof (struct _gdk_span *) * h);
+
+ for (i = 0; i < h; i++)
+ spans[i] = NULL;
+ XQueryTree (disp, win, &rt, &par, &list, (unsigned int *)&num);
+ if (list)
+ {
+ /* go through all child windows and create/insert spans */
+ for (i = 0; i < num; i++)
+ {
+ if (XGetWindowAttributes (disp, list[i], &xatt) && (xatt.map_state != IsUnmapped))
+ if (XGetGeometry (disp, list[i], &rt, &x, &y, &w, &h, &d, &d))
+ gdk_add_rectangles (disp, list[i], spans, basew, baseh, x, y);
+ }
+ if (merge)
+ gdk_add_rectangles (disp, win, spans, basew, baseh, x, y);
+
+ /* go through the spans list and build a list of rects */
+ rects = g_malloc (sizeof (XRectangle) * 256);
+ num_rects = 0;
+ for (i = 0; i < baseh; i++)
+ {
+ ptr1 = spans[i];
+ /* go through the line for all spans */
+ while (ptr1)
+ {
+ rects[num_rects].x = ptr1->start;
+ rects[num_rects].y = i;
+ rects[num_rects].width = ptr1->end - ptr1->start + 1;
+ rects[num_rects].height = 1;
+ j = i + 1;
+ /* if there are more lines */
+ contig = 1;
+ /* while contigous rects (same start/end coords) exist */
+ while ((contig) && (j < baseh))
+ {
+ /* search next line for spans matching this one */
+ contig = 0;
+ ptr2 = spans[j];
+ ptr3 = NULL;
+ while (ptr2)
{
- /* search next line for spans matching this one */
- contig = 0;
- ptr2 = spans[j];
- ptr3 = NULL;
- while (ptr2)
- {
- /* if we have an exact span match set contig */
- if ((ptr2->start == ptr1->start) &&
- (ptr2->end == ptr1->end))
- {
- contig = 1;
- /* remove the span - not needed */
- if (ptr3)
- {
- ptr3->next = ptr2->next;
- g_free(ptr2);
- ptr2 = NULL;
- }
- else
- {
- spans[j] = ptr2->next;
- g_free(ptr2);
- ptr2 = NULL;
- }
- break;
- }
- /* gone past the span point no point looking */
- else if (ptr2->start < ptr1->start)
- break;
- if (ptr2)
- {
- ptr3 = ptr2;
- ptr2 = ptr2->next;
- }
- }
- /* if a contiguous span was found increase the rect h */
- if (contig)
- {
- rects[num_rects].height++;
- j++;
- }
+ /* if we have an exact span match set contig */
+ if ((ptr2->start == ptr1->start) &&
+ (ptr2->end == ptr1->end))
+ {
+ contig = 1;
+ /* remove the span - not needed */
+ if (ptr3)
+ {
+ ptr3->next = ptr2->next;
+ g_free (ptr2);
+ ptr2 = NULL;
+ }
+ else
+ {
+ spans[j] = ptr2->next;
+ g_free (ptr2);
+ ptr2 = NULL;
+ }
+ break;
+ }
+ /* gone past the span point no point looking */
+ else if (ptr2->start < ptr1->start)
+ break;
+ if (ptr2)
+ {
+ ptr3 = ptr2;
+ ptr2 = ptr2->next;
+ }
}
- /* up the rect count */
- num_rects++;
- /* every 256 new rects increase the rect array */
- if ((num_rects % 256) == 0)
- rects = g_realloc(rects, sizeof(XRectangle) * (num_rects + 256));
- ptr1 = ptr1->next;
- }
- }
- /* set the rects as the shape mask */
- if (rects)
- {
- XShapeCombineRectangles(disp, win, ShapeBounding, 0, 0, rects, num_rects,
- ShapeSet, YXSorted);
- g_free(rects);
- }
- XFree(list);
- }
- /* free up all the spans we made */
- for (i = 0; i < baseh; i++)
- {
- ptr1 = spans[i];
- while (ptr1)
- {
- ptr2 = ptr1;
- ptr1 = ptr1->next;
- g_free(ptr2);
- }
- }
- g_free(spans);
+ /* if a contiguous span was found increase the rect h */
+ if (contig)
+ {
+ rects[num_rects].height++;
+ j++;
+ }
+ }
+ /* up the rect count */
+ num_rects++;
+ /* every 256 new rects increase the rect array */
+ if ((num_rects % 256) == 0)
+ rects = g_realloc (rects, sizeof (XRectangle) * (num_rects + 256));
+ ptr1 = ptr1->next;
+ }
+ }
+ /* set the rects as the shape mask */
+ if (rects)
+ {
+ XShapeCombineRectangles (disp, win, ShapeBounding, 0, 0, rects, num_rects,
+ ShapeSet, YXSorted);
+ g_free (rects);
+ }
+ XFree (list);
+ }
+ /* free up all the spans we made */
+ for (i = 0; i < baseh; i++)
+ {
+ ptr1 = spans[i];
+ while (ptr1)
+ {
+ ptr2 = ptr1;
+ ptr1 = ptr1->next;
+ g_free (ptr2);
+ }
+ }
+ g_free (spans);
}
void
gdk_window_set_child_shapes (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
#ifdef HAVE_SHAPE_EXT
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return;
-
- if (gdk_window_have_shape_ext())
+
+ if (gdk_window_have_shape_ext ())
gdk_propagate_shapes (private->xdisplay, private->xwindow, FALSE);
#endif
}
@@ -2515,8 +2524,8 @@ gdk_window_merge_child_shapes (GdkWindow *window)
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return;
-
- if (gdk_window_have_shape_ext())
+
+ if (gdk_window_have_shape_ext ())
gdk_propagate_shapes (private->xdisplay, private->xwindow, TRUE);
#endif
}
@@ -2534,9 +2543,9 @@ gboolean
gdk_window_is_visible (GdkWindow *window)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-
+
g_return_val_if_fail (window != NULL, FALSE);
-
+
return private->mapped;
}
@@ -2556,19 +2565,19 @@ gboolean
gdk_window_is_viewable (GdkWindow *window)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-
+
g_return_val_if_fail (window != NULL, FALSE);
-
+
while (private &&
(private != &gdk_root_parent) &&
(private->window_type != GDK_WINDOW_FOREIGN))
{
if (!private->mapped)
return FALSE;
-
+
private = (GdkWindowPrivate *)private->parent;
}
-
+
return TRUE;
}
@@ -2591,7 +2600,7 @@ gdk_window_gravity_works (void)
{
enum { UNKNOWN, NO, YES };
static gint gravity_works = UNKNOWN;
-
+
if (gravity_works == UNKNOWN)
{
GdkWindowAttr attr;
@@ -2621,7 +2630,7 @@ gdk_window_gravity_works (void)
attr.window_type = GDK_WINDOW_CHILD;
child = gdk_window_new (parent, &attr, GDK_WA_X | GDK_WA_Y);
-
+
gdk_window_set_static_win_gravity (child, TRUE);
gdk_window_resize (parent, 100, 110);
@@ -2636,10 +2645,10 @@ gdk_window_gravity_works (void)
gdk_window_destroy (parent);
gdk_window_destroy (child);
-
+
gravity_works = ((y == -20) ? YES : NO);
}
-
+
return (gravity_works == YES);
}
@@ -2648,9 +2657,9 @@ gdk_window_set_static_bit_gravity (GdkWindow *window, gboolean on)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
XSetWindowAttributes xattributes;
-
+
g_return_if_fail (window != NULL);
-
+
xattributes.bit_gravity = on ? StaticGravity : ForgetGravity;
XChangeWindowAttributes (private->xdisplay,
private->xwindow,
@@ -2662,11 +2671,11 @@ gdk_window_set_static_win_gravity (GdkWindow *window, gboolean on)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
XSetWindowAttributes xattributes;
-
+
g_return_if_fail (window != NULL);
-
+
xattributes.win_gravity = on ? StaticGravity : NorthWestGravity;
-
+
XChangeWindowAttributes (private->xdisplay,
private->xwindow,
CWWinGravity, &xattributes);
@@ -2690,7 +2699,7 @@ gdk_window_set_static_gravities (GdkWindow *window,
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
GList *tmp_list;
-
+
g_return_val_if_fail (window != NULL, FALSE);
if (!use_static == !private->guffaw_gravity)
@@ -2698,11 +2707,11 @@ gdk_window_set_static_gravities (GdkWindow *window,
if (use_static && !gdk_window_gravity_works ())
return FALSE;
-
+
private->guffaw_gravity = use_static;
-
+
gdk_window_set_static_bit_gravity (window, use_static);
-
+
tmp_list = private->children;
while (tmp_list)
{
@@ -2710,6 +2719,6 @@ gdk_window_set_static_gravities (GdkWindow *window,
tmp_list = tmp_list->next;
}
-
+
return TRUE;
}
diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
index 3ac781aac..ab67c956b 100644
--- a/gdk/x11/gdkevents-x11.c
+++ b/gdk/x11/gdkevents-x11.c
@@ -39,21 +39,24 @@ typedef struct _GdkEventPrivate GdkEventPrivate;
#define DOUBLE_CLICK_DIST 5
#define TRIPLE_CLICK_DIST 5
-typedef enum {
+typedef enum
+{
/* Following flag is set for events on the event queue during
* translation and cleared afterwards.
*/
GDK_EVENT_PENDING = 1 << 0
} GdkEventFlags;
-struct _GdkIOClosure {
+struct _GdkIOClosure
+{
GdkInputFunction function;
GdkInputCondition condition;
GdkDestroyNotify notify;
gpointer data;
};
-struct _GdkEventPrivate {
+struct _GdkEventPrivate
+{
GdkEvent event;
guint flags;
};
@@ -63,30 +66,30 @@ struct _GdkEventPrivate {
*/
static GdkEvent *gdk_event_new (void);
-static gint gdk_event_apply_filters (XEvent *xevent,
+static gint gdk_event_apply_filters (XEvent *xevent,
GdkEvent *event,
- GList *filters);
+ GList *filters);
static gint gdk_event_translate (GdkEvent *event,
XEvent *xevent);
#if 0
-static Bool gdk_event_get_type (Display *display,
- XEvent *xevent,
- XPointer arg);
+static Bool gdk_event_get_type (Display *display,
+ XEvent *xevent,
+ XPointer arg);
#endif
static void gdk_events_queue (void);
-static GdkEvent *gdk_event_unqueue (void);
+static GdkEvent* gdk_event_unqueue (void);
-static gboolean gdk_event_prepare (gpointer source_data,
- GTimeVal *current_time,
- gint *timeout);
-static gboolean gdk_event_check (gpointer source_data,
- GTimeVal *current_time);
-static gboolean gdk_event_dispatch (gpointer source_data,
- GTimeVal *current_time,
- gpointer user_data);
+static gboolean gdk_event_prepare (gpointer source_data,
+ GTimeVal *current_time,
+ gint *timeout);
+static gboolean gdk_event_check (gpointer source_data,
+ GTimeVal *current_time);
+static gboolean gdk_event_dispatch (gpointer source_data,
+ GTimeVal *current_time,
+ gpointer user_data);
-static void gdk_synthesize_click (GdkEvent *event,
- gint nclicks);
+static void gdk_synthesize_click (GdkEvent *event,
+ gint nclicks);
GdkFilterReturn gdk_wm_protocols_filter (GdkXEvent *xev,
GdkEvent *event,
@@ -111,11 +114,11 @@ static GdkWindow *button_window[2]; /* The last 2 windows to receive button
*/
static guint button_number[2]; /* The last 2 buttons to be pressed.
*/
-static GdkEventFunc event_func; /* Callback for events */
-static gpointer event_data;
-static GDestroyNotify event_notify;
+static GdkEventFunc event_func = NULL; /* Callback for events */
+static gpointer event_data = NULL;
+static GDestroyNotify event_notify = NULL;
-static GList *client_filters; /* Filters for client messages */
+static GList *client_filters; /* Filters for client messages */
/* FIFO's for event queue, and for events put back using
* gdk_event_put().
@@ -146,7 +149,7 @@ GPollFD event_poll_fd;
* Pointer to the list node for that event, or NULL
*************************************************************/
-static GList *
+static GList*
gdk_event_queue_find_first (void)
{
GList *tmp_list = queued_events;
@@ -197,7 +200,7 @@ gdk_event_queue_remove_link (GList *node)
static void
gdk_event_queue_append (GdkEvent *event)
{
- queued_tail = g_list_append(queued_tail, event);
+ queued_tail = g_list_append (queued_tail, event);
if (!queued_events)
queued_events = queued_tail;
@@ -269,23 +272,23 @@ gdk_events_pending (void)
*-------------------------------------------------------------- */
static Bool
-graphics_expose_predicate (Display *display,
- XEvent *xevent,
- XPointer arg)
+graphics_expose_predicate (Display *display,
+ XEvent *xevent,
+ XPointer arg)
{
- GdkWindowPrivate *private = (GdkWindowPrivate *)arg;
+ GdkWindowPrivate *private = (GdkWindowPrivate*) arg;
g_return_val_if_fail (private != NULL, False);
- if ((xevent->xany.window == private->xwindow) &&
- ((xevent->xany.type == GraphicsExpose) ||
- (xevent->xany.type == NoExpose)))
+ if (xevent->xany.window == private->xwindow &&
+ (xevent->xany.type == GraphicsExpose ||
+ xevent->xany.type == NoExpose))
return True;
else
return False;
}
-GdkEvent *
+GdkEvent*
gdk_event_get_graphics_expose (GdkWindow *window)
{
XEvent xevent;
@@ -293,7 +296,7 @@ gdk_event_get_graphics_expose (GdkWindow *window)
g_return_val_if_fail (window != NULL, NULL);
- XIfEvent (gdk_display, &xevent, graphics_expose_predicate, (XPointer)window);
+ XIfEvent (gdk_display, &xevent, graphics_expose_predicate, (XPointer) window);
if (xevent.xany.type == GraphicsExpose)
{
@@ -368,15 +371,18 @@ gdk_add_rect_to_rects (GdkRectangle *rect1,
typedef struct _GdkExposeInfo GdkExposeInfo;
-struct _GdkExposeInfo {
+struct _GdkExposeInfo
+{
Window window;
gboolean seen_nonmatching;
};
-Bool
-expose_predicate (Display *display, XEvent *xevent, XPointer arg)
+static Bool
+expose_predicate (Display *display,
+ XEvent *xevent,
+ XPointer arg)
{
- GdkExposeInfo *info = (GdkExposeInfo *)arg;
+ GdkExposeInfo *info = (GdkExposeInfo*) arg;
/* Compressing across GravityNotify events is safe, because
* we completely ignore them, so they can't change what
@@ -385,22 +391,23 @@ expose_predicate (Display *display, XEvent *xevent, XPointer arg)
* we'll get a whole bunch of them interspersed with
* expose events.
*/
- if ((xevent->xany.type != Expose) &&
- (xevent->xany.type != GravityNotify))
+ if (xevent->xany.type != Expose &&
+ xevent->xany.type != GravityNotify)
{
info->seen_nonmatching = TRUE;
}
if (info->seen_nonmatching ||
- (xevent->xany.type != Expose) ||
- (xevent->xany.window != info->window))
+ xevent->xany.type != Expose ||
+ xevent->xany.window != info->window)
return FALSE;
else
return TRUE;
}
void
-gdk_compress_exposures (XEvent *xevent, GdkWindow *window)
+gdk_compress_exposures (XEvent *xevent,
+ GdkWindow *window)
{
gint nrects = 1;
gint count = 0;
@@ -522,7 +529,7 @@ gdk_event_handler_set (GdkEventFunc func,
gpointer data,
GDestroyNotify notify)
{
- if (event_func && event_notify)
+ if (event_notify)
(*event_notify) (event_data);
event_func = func;
@@ -548,12 +555,12 @@ gdk_event_handler_set (GdkEventFunc func,
*--------------------------------------------------------------
*/
-GdkEvent *
+GdkEvent*
gdk_event_get (void)
{
- gdk_events_queue();
+ gdk_events_queue ();
- return gdk_event_unqueue();
+ return gdk_event_unqueue ();
}
/*
@@ -575,7 +582,7 @@ gdk_event_get (void)
*--------------------------------------------------------------
*/
-GdkEvent *
+GdkEvent*
gdk_event_peek (void)
{
GList *tmp_list;
@@ -618,7 +625,7 @@ gdk_event_put (GdkEvent *event)
*--------------------------------------------------------------
*/
-static GMemChunk *event_chunk;
+static GMemChunk *event_chunk = NULL;
static GdkEvent*
gdk_event_new (void)
@@ -634,7 +641,7 @@ gdk_event_new (void)
new_event = g_chunk_new (GdkEventPrivate, event_chunk);
new_event->flags = 0;
- return (GdkEvent *)new_event;
+ return (GdkEvent*) new_event;
}
GdkEvent*
@@ -670,7 +677,6 @@ gdk_event_copy (GdkEvent *event)
case GDK_DROP_FINISHED:
gdk_drag_context_ref (event->dnd.context);
break;
-
default:
break;
@@ -700,8 +706,9 @@ gdk_event_copy (GdkEvent *event)
void
gdk_event_free (GdkEvent *event)
{
- g_assert (event_chunk != NULL);
g_return_if_fail (event != NULL);
+
+ g_assert (event_chunk != NULL); /* paranoid */
if (event->any.window)
gdk_window_unref (event->any.window);
@@ -727,7 +734,6 @@ gdk_event_free (GdkEvent *event)
case GDK_DROP_FINISHED:
gdk_drag_context_unref (event->dnd.context);
break;
-
default:
break;
@@ -811,7 +817,7 @@ gdk_event_get_time (GdkEvent *event)
*/
void
-gdk_set_show_events (int show_events)
+gdk_set_show_events (gint show_events)
{
if (show_events)
gdk_debug_flags |= GDK_DEBUG_EVENTS;
@@ -882,9 +888,9 @@ gdk_input_add_full (gint source,
cond |= G_IO_ERR|G_IO_HUP|G_IO_NVAL;
channel = g_io_channel_unix_new (source);
- result = g_io_add_watch_full (channel, G_PRIORITY_DEFAULT, cond,
- gdk_io_invoke,
- closure, gdk_io_destroy);
+ result = g_io_add_watch_full (channel, G_PRIORITY_DEFAULT, cond,
+ gdk_io_invoke,
+ closure, gdk_io_destroy);
g_io_channel_unref (channel);
return result;
@@ -918,9 +924,9 @@ gdk_event_apply_filters (XEvent *xevent,
while (tmp_list)
{
- filter = (GdkEventFilter *)tmp_list->data;
+ filter = (GdkEventFilter*) tmp_list->data;
- result = (*filter->function)(xevent, event, filter->data);
+ result = (*filter->function) (xevent, event, filter->data);
if (result != GDK_FILTER_CONTINUE)
return result;
@@ -2020,8 +2026,8 @@ gdk_event_prepare (gpointer source_data,
}
static gboolean
-gdk_event_check (gpointer source_data,
- GTimeVal *current_time)
+gdk_event_check (gpointer source_data,
+ GTimeVal *current_time)
{
gboolean retval;
@@ -2037,7 +2043,7 @@ gdk_event_check (gpointer source_data,
return retval;
}
-static GdkEvent *
+static GdkEvent*
gdk_event_unqueue (void)
{
GdkEvent *event = NULL;
@@ -2215,7 +2221,8 @@ gdk_event_send_clientmessage_toall (GdkEvent *event)
*--------------------------------------------------------------
*/
-void gdk_flush (void)
+void
+gdk_flush (void)
{
XSync (gdk_display, False);
}
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index e6695e242..e941db46f 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -67,7 +67,7 @@ const int gdk_event_mask_table[20] =
0, /* PROXIMTY_OUT */
SubstructureNotifyMask
};
-const int gdk_nevent_masks = sizeof(gdk_event_mask_table)/sizeof(int);
+const int gdk_nevent_masks = sizeof (gdk_event_mask_table) / sizeof (int);
/* Forward declarations */
static gboolean gdk_window_gravity_works (void);
@@ -85,50 +85,50 @@ gdk_window_xid_at (Window base,
GList *excludes,
gboolean excl_child)
{
- GdkWindow *window;
- GdkWindowPrivate *private;
- Display *disp;
- Window *list = NULL;
- Window child = 0, parent_win = 0, root_win = 0;
- int i;
- unsigned int ww, wh, wb, wd, num;
- int wx, wy;
-
- window = (GdkWindow*) &gdk_root_parent;
- private = (GdkWindowPrivate*) window;
- disp = private->xdisplay;
- if (!XGetGeometry (disp, base, &root_win, &wx, &wy, &ww, &wh, &wb, &wd))
- return 0;
- wx += bx;
- wy += by;
-
- if (!((x >= wx) &&
- (y >= wy) &&
- (x < (int) (wx + ww)) &&
- (y < (int) (wy + wh))))
- return 0;
-
- if (!XQueryTree (disp, base, &root_win, &parent_win, &list, &num))
- return base;
-
- if (list)
- {
- for (i = num - 1; ; i--)
- {
- if ((!excl_child) || (!g_list_find (excludes, (gpointer *) list[i])))
- {
- if ((child = gdk_window_xid_at (list[i], wx, wy, x, y, excludes, excl_child)) != 0)
- {
- XFree (list);
- return child;
- }
- }
- if (!i)
- break;
- }
- XFree (list);
- }
- return base;
+ GdkWindow *window;
+ GdkWindowPrivate *private;
+ Display *disp;
+ Window *list = NULL;
+ Window child = 0, parent_win = 0, root_win = 0;
+ int i;
+ unsigned int ww, wh, wb, wd, num;
+ int wx, wy;
+
+ window = (GdkWindow*) &gdk_root_parent;
+ private = (GdkWindowPrivate*) window;
+ disp = private->xdisplay;
+ if (!XGetGeometry (disp, base, &root_win, &wx, &wy, &ww, &wh, &wb, &wd))
+ return 0;
+ wx += bx;
+ wy += by;
+
+ if (!((x >= wx) &&
+ (y >= wy) &&
+ (x < (int) (wx + ww)) &&
+ (y < (int) (wy + wh))))
+ return 0;
+
+ if (!XQueryTree (disp, base, &root_win, &parent_win, &list, &num))
+ return base;
+
+ if (list)
+ {
+ for (i = num - 1; ; i--)
+ {
+ if ((!excl_child) || (!g_list_find (excludes, (gpointer *) list[i])))
+ {
+ if ((child = gdk_window_xid_at (list[i], wx, wy, x, y, excludes, excl_child)) != 0)
+ {
+ XFree (list);
+ return child;
+ }
+ }
+ if (!i)
+ break;
+ }
+ XFree (list);
+ }
+ return base;
}
/*
@@ -150,64 +150,64 @@ gdk_window_xid_at_coords (gint x,
GList *excludes,
gboolean excl_child)
{
- GdkWindow *window;
- GdkWindowPrivate *private;
- Display *disp;
- Window *list = NULL;
- Window root, child = 0, parent_win = 0, root_win = 0;
- unsigned int num;
- int i;
-
- window = (GdkWindow*) &gdk_root_parent;
- private = (GdkWindowPrivate*) window;
- disp = private->xdisplay;
- root = private->xwindow;
- num = g_list_length (excludes);
-
- XGrabServer (disp);
- if (!XQueryTree (disp, root, &root_win, &parent_win, &list, &num))
- {
- XUngrabServer(disp);
- return root;
- }
- if (list)
- {
- i = num - 1;
- do
- {
- XWindowAttributes xwa;
-
- XGetWindowAttributes (disp, list [i], &xwa);
-
- if (xwa.map_state != IsViewable)
- continue;
-
- if (excl_child && g_list_find (excludes, (gpointer *) list[i]))
- continue;
-
- if ((child = gdk_window_xid_at (list[i], 0, 0, x, y, excludes, excl_child)) == 0)
- continue;
-
- if (excludes)
- {
- if (!g_list_find (excludes, (gpointer *) child))
- {
- XFree (list);
- XUngrabServer (disp);
- return child;
- }
- }
- else
- {
- XFree (list);
- XUngrabServer (disp);
- return child;
- }
- } while (--i > 0);
- XFree (list);
- }
- XUngrabServer (disp);
- return root;
+ GdkWindow *window;
+ GdkWindowPrivate *private;
+ Display *disp;
+ Window *list = NULL;
+ Window root, child = 0, parent_win = 0, root_win = 0;
+ unsigned int num;
+ int i;
+
+ window = (GdkWindow*) &gdk_root_parent;
+ private = (GdkWindowPrivate*) window;
+ disp = private->xdisplay;
+ root = private->xwindow;
+ num = g_list_length (excludes);
+
+ XGrabServer (disp);
+ if (!XQueryTree (disp, root, &root_win, &parent_win, &list, &num))
+ {
+ XUngrabServer (disp);
+ return root;
+ }
+ if (list)
+ {
+ i = num - 1;
+ do
+ {
+ XWindowAttributes xwa;
+
+ XGetWindowAttributes (disp, list [i], &xwa);
+
+ if (xwa.map_state != IsViewable)
+ continue;
+
+ if (excl_child && g_list_find (excludes, (gpointer *) list[i]))
+ continue;
+
+ if ((child = gdk_window_xid_at (list[i], 0, 0, x, y, excludes, excl_child)) == 0)
+ continue;
+
+ if (excludes)
+ {
+ if (!g_list_find (excludes, (gpointer *) child))
+ {
+ XFree (list);
+ XUngrabServer (disp);
+ return child;
+ }
+ }
+ else
+ {
+ XFree (list);
+ XUngrabServer (disp);
+ return child;
+ }
+ } while (--i > 0);
+ XFree (list);
+ }
+ XUngrabServer (disp);
+ return root;
}
void
@@ -219,11 +219,11 @@ gdk_window_init (void)
unsigned int border_width;
unsigned int depth;
int x, y;
-
+
XGetGeometry (gdk_display, gdk_root_window, &gdk_root_window,
&x, &y, &width, &height, &border_width, &depth);
XGetWindowAttributes (gdk_display, gdk_root_window, &xattributes);
-
+
gdk_root_parent.xwindow = gdk_root_window;
gdk_root_parent.xdisplay = gdk_display;
gdk_root_parent.window_type = GDK_WINDOW_ROOT;
@@ -233,7 +233,7 @@ gdk_window_init (void)
gdk_root_parent.children = NULL;
gdk_root_parent.colormap = NULL;
gdk_root_parent.ref_count = 1;
-
+
gdk_xid_table_insert (&gdk_root_window, &gdk_root_parent);
}
@@ -260,24 +260,24 @@ gdk_window_new (GdkWindow *parent,
unsigned int class;
char *title;
int i;
-
+
g_return_val_if_fail (attributes != NULL, NULL);
-
+
if (!parent)
parent = (GdkWindow*) &gdk_root_parent;
-
+
parent_private = (GdkWindowPrivate*) parent;
if (parent_private->destroyed)
return NULL;
-
+
xparent = parent_private->xwindow;
parent_display = parent_private->xdisplay;
-
+
private = g_new (GdkWindowPrivate, 1);
window = (GdkWindow*) private;
-
+
private->parent = parent;
-
+
private->xdisplay = parent_display;
private->destroyed = FALSE;
private->mapped = FALSE;
@@ -285,106 +285,106 @@ gdk_window_new (GdkWindow *parent,
private->resize_count = 0;
private->ref_count = 1;
xattributes_mask = 0;
-
+
if (attributes_mask & GDK_WA_X)
x = attributes->x;
else
x = 0;
-
+
if (attributes_mask & GDK_WA_Y)
y = attributes->y;
else
y = 0;
-
+
private->x = x;
private->y = y;
private->width = (attributes->width > 1) ? (attributes->width) : (1);
private->height = (attributes->height > 1) ? (attributes->height) : (1);
private->window_type = attributes->window_type;
private->extension_events = FALSE;
-
+
private->filters = NULL;
private->children = NULL;
-
+
window->user_data = NULL;
-
+
if (attributes_mask & GDK_WA_VISUAL)
visual = attributes->visual;
else
visual = gdk_visual_get_system ();
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
-
+
xattributes.event_mask = StructureNotifyMask;
for (i = 0; i < gdk_nevent_masks; i++)
{
if (attributes->event_mask & (1 << (i + 1)))
xattributes.event_mask |= gdk_event_mask_table[i];
}
-
+
if (xattributes.event_mask)
xattributes_mask |= CWEventMask;
-
+
if (attributes_mask & GDK_WA_NOREDIR)
{
xattributes.override_redirect =
- (attributes->override_redirect == FALSE)?False:True;
+ (attributes->override_redirect == FALSE)?False:True;
xattributes_mask |= CWOverrideRedirect;
}
else
xattributes.override_redirect = False;
-
+
if (parent_private && parent_private->guffaw_gravity)
{
xattributes.win_gravity = StaticGravity;
xattributes_mask |= CWWinGravity;
}
-
+
if (attributes->wclass == GDK_INPUT_OUTPUT)
{
class = InputOutput;
depth = visual->depth;
-
+
if (attributes_mask & GDK_WA_COLORMAP)
private->colormap = attributes->colormap;
else
{
- if ((((GdkVisualPrivate*)gdk_visual_get_system())->xvisual) == xvisual)
+ if ((((GdkVisualPrivate*)gdk_visual_get_system ())->xvisual) == xvisual)
private->colormap = gdk_colormap_get_system ();
else
private->colormap = gdk_colormap_new (visual, False);
}
-
+
xattributes.background_pixel = BlackPixel (gdk_display, gdk_screen);
xattributes.border_pixel = BlackPixel (gdk_display, gdk_screen);
xattributes_mask |= CWBorderPixel | CWBackPixel;
-
+
switch (private->window_type)
{
case GDK_WINDOW_TOPLEVEL:
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
xattributes_mask |= CWColormap;
-
+
xparent = gdk_root_window;
break;
-
+
case GDK_WINDOW_CHILD:
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
xattributes_mask |= CWColormap;
break;
-
+
case GDK_WINDOW_DIALOG:
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
xattributes_mask |= CWColormap;
-
+
xparent = gdk_root_window;
break;
-
+
case GDK_WINDOW_TEMP:
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
xattributes_mask |= CWColormap;
-
+
xparent = gdk_root_window;
-
+
xattributes.save_under = True;
xattributes.override_redirect = True;
xattributes.cursor = None;
@@ -404,24 +404,24 @@ gdk_window_new (GdkWindow *parent,
class = InputOnly;
private->colormap = NULL;
}
-
+
private->xwindow = XCreateWindow (private->xdisplay, xparent,
x, y, private->width, private->height,
0, depth, class, xvisual,
xattributes_mask, &xattributes);
gdk_window_ref (window);
gdk_xid_table_insert (&private->xwindow, window);
-
+
if (private->colormap)
gdk_colormap_ref (private->colormap);
-
+
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
(attributes->cursor) :
NULL));
-
+
if (parent_private)
parent_private->children = g_list_prepend (parent_private->children, window);
-
+
switch (private->window_type)
{
case GDK_WINDOW_DIALOG:
@@ -438,48 +438,48 @@ gdk_window_new (GdkWindow *parent,
GDK_NOTE (MISC, g_message ("adding colormap window\n"));
gdk_window_add_colormap_windows (window);
}
-
+
return window;
default:
-
+
return window;
}
-
+
size_hints.flags = PSize;
size_hints.width = private->width;
size_hints.height = private->height;
-
+
wm_hints.flags = InputHint | StateHint | WindowGroupHint;
wm_hints.window_group = gdk_leader_window;
wm_hints.input = True;
wm_hints.initial_state = NormalState;
-
+
/* FIXME: Is there any point in doing this? Do any WM's pay
* attention to PSize, and even if they do, is this the
* correct value???
*/
XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
-
+
XSetWMHints (private->xdisplay, private->xwindow, &wm_hints);
-
+
if (!wm_client_leader_atom)
- wm_client_leader_atom = gdk_atom_intern ("WM_CLIENT_LEADER", FALSE);
-
+ wm_client_leader_atom = gdk_atom_intern ("WM_CLIENT_LEADER", FALSE);
+
XChangeProperty (private->xdisplay, private->xwindow,
wm_client_leader_atom,
XA_WINDOW, 32, PropModeReplace,
(guchar*) &gdk_leader_window, 1);
-
+
if (attributes_mask & GDK_WA_TITLE)
title = attributes->title;
else
title = g_get_prgname ();
-
+
XmbSetWMProperties (private->xdisplay, private->xwindow,
title, title,
NULL, 0,
NULL, NULL, NULL);
-
+
if (attributes_mask & GDK_WA_WMCLASS)
{
class_hint = XAllocClassHint ();
@@ -488,8 +488,8 @@ gdk_window_new (GdkWindow *parent,
XSetClassHint (private->xdisplay, private->xwindow, class_hint);
XFree (class_hint);
}
-
-
+
+
return window;
}
@@ -503,28 +503,28 @@ gdk_window_foreign_new (guint32 anid)
Window root, parent;
Window *children = NULL;
guint nchildren;
-
- if(!XGetWindowAttributes (gdk_display, anid, &attrs)) {
- g_warning("XGetWindowAttributes failed on window ID %d\n", anid);
+
+ if (!XGetWindowAttributes (gdk_display, anid, &attrs)) {
+ g_warning ("XGetWindowAttributes failed on window ID %d\n", anid);
return NULL;
}
-
+
private = g_new (GdkWindowPrivate, 1);
window = (GdkWindow*) private;
-
+
/* FIXME: This is pretty expensive. Maybe the caller should supply
* the parent */
XQueryTree (gdk_display, anid, &root, &parent, &children, &nchildren);
-
+
if (children)
XFree (children);
private->parent = gdk_xid_table_lookup (parent);
-
+
parent_private = (GdkWindowPrivate *)private->parent;
if (parent_private)
parent_private->children = g_list_prepend (parent_private->children, window);
-
+
private->xwindow = anid;
private->xdisplay = gdk_display;
private->x = attrs.x;
@@ -538,17 +538,17 @@ gdk_window_foreign_new (guint32 anid)
private->mapped = (attrs.map_state != IsUnmapped);
private->guffaw_gravity = FALSE;
private->extension_events = 0;
-
+
private->colormap = NULL;
-
+
private->filters = NULL;
private->children = NULL;
-
+
window->user_data = NULL;
-
+
gdk_window_ref (window);
gdk_xid_table_insert (&private->xwindow, window);
-
+
return window;
}
@@ -568,11 +568,11 @@ gdk_window_internal_destroy (GdkWindow *window,
GdkWindow *temp_window;
GList *children;
GList *tmp;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
-
+
switch (private->window_type)
{
case GDK_WINDOW_TOPLEVEL:
@@ -588,12 +588,12 @@ gdk_window_internal_destroy (GdkWindow *window,
if (parent_private->children)
parent_private->children = g_list_remove (parent_private->children, window);
}
-
+
if (private->window_type != GDK_WINDOW_FOREIGN)
{
children = tmp = private->children;
private->children = NULL;
-
+
while (tmp)
{
temp_window = tmp->data;
@@ -604,23 +604,23 @@ gdk_window_internal_destroy (GdkWindow *window,
gdk_window_internal_destroy (temp_window, FALSE,
our_destroy);
}
-
+
g_list_free (children);
}
-
+
if (private->extension_events != 0)
gdk_input_window_destroy (window);
-
+
if (private->filters)
{
tmp = private->filters;
-
+
while (tmp)
{
g_free (tmp->data);
tmp = tmp->next;
}
-
+
g_list_free (private->filters);
private->filters = NULL;
}
@@ -651,19 +651,19 @@ gdk_window_internal_destroy (GdkWindow *window,
}
else if (xdestroy)
XDestroyWindow (private->xdisplay, private->xwindow);
-
+
if (private->colormap)
gdk_colormap_unref (private->colormap);
-
+
private->mapped = FALSE;
private->destroyed = TRUE;
}
break;
-
+
case GDK_WINDOW_ROOT:
g_error ("attempted to destroy root window");
break;
-
+
case GDK_WINDOW_PIXMAP:
g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)");
break;
@@ -686,11 +686,11 @@ void
gdk_window_destroy_notify (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
-
+
if (!private->destroyed)
{
if (private->window_type == GDK_WINDOW_FOREIGN)
@@ -708,7 +708,7 @@ gdk_window_ref (GdkWindow *window)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
g_return_val_if_fail (window != NULL, NULL);
-
+
private->ref_count += 1;
return window;
}
@@ -718,7 +718,7 @@ gdk_window_unref (GdkWindow *window)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
g_return_if_fail (window != NULL);
-
+
private->ref_count -= 1;
if (private->ref_count == 0)
{
@@ -738,9 +738,9 @@ void
gdk_window_show (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
{
@@ -754,9 +754,9 @@ void
gdk_window_hide (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
{
@@ -769,9 +769,9 @@ void
gdk_window_withdraw (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
XWithdrawWindow (private->xdisplay, private->xwindow, 0);
@@ -783,9 +783,9 @@ gdk_window_move (GdkWindow *window,
gint y)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
{
@@ -805,16 +805,16 @@ gdk_window_resize (GdkWindow *window,
gint height)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
if (width < 1)
width = 1;
if (height < 1)
height = 1;
-
+
private = (GdkWindowPrivate*) window;
-
+
if (!private->destroyed &&
((private->resize_count > 0) ||
(private->width != (guint16) width) ||
@@ -822,7 +822,7 @@ gdk_window_resize (GdkWindow *window,
{
XResizeWindow (private->xdisplay, private->xwindow, width, height);
private->resize_count += 1;
-
+
if (private->window_type == GDK_WINDOW_CHILD)
{
private->width = width;
@@ -839,14 +839,14 @@ gdk_window_move_resize (GdkWindow *window,
gint height)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
if (width < 1)
width = 1;
if (height < 1)
height = 1;
-
+
private = (GdkWindowPrivate*) window;
if (!private->destroyed)
{
@@ -858,7 +858,7 @@ gdk_window_move_resize (GdkWindow *window,
while (tmp_list)
{
GdkWindowPrivate *child_private = tmp_list->data;
-
+
child_private->x -= x - private->x;
child_private->y -= y - private->y;
@@ -885,27 +885,27 @@ gdk_window_reparent (GdkWindow *window,
GdkWindowPrivate *window_private;
GdkWindowPrivate *parent_private;
GdkWindowPrivate *old_parent_private;
-
+
g_return_if_fail (window != NULL);
-
+
if (!new_parent)
new_parent = (GdkWindow*) &gdk_root_parent;
-
+
window_private = (GdkWindowPrivate*) window;
old_parent_private = (GdkWindowPrivate*)window_private->parent;
parent_private = (GdkWindowPrivate*) new_parent;
-
+
if (!window_private->destroyed && !parent_private->destroyed)
XReparentWindow (window_private->xdisplay,
window_private->xwindow,
parent_private->xwindow,
x, y);
-
+
window_private->parent = new_parent;
-
+
if (old_parent_private)
old_parent_private->children = g_list_remove (old_parent_private->children, window);
-
+
if ((old_parent_private &&
(!old_parent_private->guffaw_gravity != !parent_private->guffaw_gravity)) ||
(!old_parent_private && parent_private->guffaw_gravity))
@@ -918,11 +918,11 @@ void
gdk_window_clear (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
-
+
if (!private->destroyed)
XClearWindow (private->xdisplay, private->xwindow);
}
@@ -1178,11 +1178,11 @@ gdk_window_set_role (GdkWindow *window,
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
-
+
if (role)
XChangeProperty (private->xdisplay, private->xwindow,
gdk_atom_intern ("WM_WINDOW_ROLE", FALSE), XA_STRING,
- 8, PropModeReplace, role, strlen(role));
+ 8, PropModeReplace, role, strlen (role));
else
XDeleteProperty (private->xdisplay, private->xwindow,
gdk_atom_intern ("WM_WINDOW_ROLE", FALSE));
@@ -1199,7 +1199,7 @@ gdk_window_set_transient_for (GdkWindow *window,
private = (GdkWindowPrivate*) window;
parent_private = (GdkWindowPrivate*) parent;
-
+
if (!private->destroyed && !parent_private->destroyed)
XSetTransientForHint (private->xdisplay,
private->xwindow, parent_private->xwindow);
@@ -1284,7 +1284,7 @@ gdk_window_set_colormap (GdkWindow *window,
XSetWindowColormap (window_private->xdisplay,
window_private->xwindow,
colormap_private->xcolormap);
-
+
if (window_private->colormap)
gdk_colormap_unref (window_private->colormap);
window_private->colormap = colormap;
@@ -1383,9 +1383,9 @@ gdk_window_get_visual (GdkWindow *window)
{
GdkWindowPrivate *window_private;
XWindowAttributes window_attributes;
-
+
g_return_val_if_fail (window != NULL, NULL);
-
+
window_private = (GdkWindowPrivate*) window;
/* Huh? ->parent is never set for a pixmap. We should just return
* null immeditately
@@ -1395,15 +1395,15 @@ gdk_window_get_visual (GdkWindow *window)
if (window_private && !window_private->destroyed)
{
- if (window_private->colormap == NULL)
- {
- XGetWindowAttributes (window_private->xdisplay,
- window_private->xwindow,
- &window_attributes);
- return gdk_visual_lookup (window_attributes.visual);
- }
- else
- return ((GdkColormapPrivate *)window_private->colormap)->visual;
+ if (window_private->colormap == NULL)
+ {
+ XGetWindowAttributes (window_private->xdisplay,
+ window_private->xwindow,
+ &window_attributes);
+ return gdk_visual_lookup (window_attributes.visual);
+ }
+ else
+ return ((GdkColormapPrivate *)window_private->colormap)->visual;
}
return NULL;
@@ -1417,7 +1417,7 @@ gdk_window_get_colormap (GdkWindow *window)
g_return_val_if_fail (window != NULL, NULL);
window_private = (GdkWindowPrivate*) window;
-
+
g_return_val_if_fail (window_private->window_type != GDK_WINDOW_PIXMAP, NULL);
if (!window_private->destroyed)
{
@@ -1427,9 +1427,9 @@ gdk_window_get_colormap (GdkWindow *window)
window_private->xwindow,
&window_attributes);
return gdk_colormap_lookup (window_attributes.colormap);
- }
- else
- return window_private->colormap;
+ }
+ else
+ return window_private->colormap;
}
return NULL;
@@ -1439,9 +1439,9 @@ GdkWindowType
gdk_window_get_type (GdkWindow *window)
{
GdkWindowPrivate *window_private;
-
+
g_return_val_if_fail (window != NULL, (GdkWindowType) -1);
-
+
window_private = (GdkWindowPrivate*) window;
return window_private->window_type;
}
@@ -1456,11 +1456,11 @@ gdk_window_get_origin (GdkWindow *window,
Window child;
gint tx = 0;
gint ty = 0;
-
+
g_return_val_if_fail (window != NULL, 0);
-
+
private = (GdkWindowPrivate*) window;
-
+
if (!private->destroyed)
{
return_val = XTranslateCoordinates (private->xdisplay,
@@ -1498,40 +1498,40 @@ gdk_window_get_deskrelative_origin (GdkWindow *window,
guchar *data_return;
g_return_val_if_fail (window != NULL, 0);
-
+
private = (GdkWindowPrivate*) window;
-
+
if (!private->destroyed)
{
if (!atom)
- atom = XInternAtom(private->xdisplay, "ENLIGHTENMENT_DESKTOP", False);
+ atom = XInternAtom (private->xdisplay, "ENLIGHTENMENT_DESKTOP", False);
win = private->xwindow;
-
- while (XQueryTree(private->xdisplay, win, &root, &parent,
- &child, (unsigned int *)&num_children))
+
+ while (XQueryTree (private->xdisplay, win, &root, &parent,
+ &child, (unsigned int *)&num_children))
{
if ((child) && (num_children > 0))
- XFree(child);
-
+ XFree (child);
+
if (!parent)
break;
else
win = parent;
-
+
if (win == root)
break;
data_return = NULL;
- XGetWindowProperty(private->xdisplay, win, atom, 0, 0,
- False, XA_CARDINAL, &type_return, &format_return,
- &number_return, &bytes_after_return, &data_return);
+ XGetWindowProperty (private->xdisplay, win, atom, 0, 0,
+ False, XA_CARDINAL, &type_return, &format_return,
+ &number_return, &bytes_after_return, &data_return);
if (type_return == XA_CARDINAL)
{
- XFree(data_return);
+ XFree (data_return);
break;
}
}
-
+
return_val = XTranslateCoordinates (private->xdisplay,
private->xwindow,
win,
@@ -1542,7 +1542,7 @@ gdk_window_get_deskrelative_origin (GdkWindow *window,
if (y)
*y = ty;
}
-
+
return return_val;
}
@@ -1558,9 +1558,9 @@ gdk_window_get_root_origin (GdkWindow *window,
Window root;
Window *children;
unsigned int nchildren;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
if (x)
*x = 0;
@@ -1568,12 +1568,12 @@ gdk_window_get_root_origin (GdkWindow *window,
*y = 0;
if (private->destroyed)
return;
-
+
while (private->parent && ((GdkWindowPrivate*) private->parent)->parent)
private = (GdkWindowPrivate*) private->parent;
if (private->destroyed)
return;
-
+
xparent = private->xwindow;
do
{
@@ -1582,17 +1582,17 @@ gdk_window_get_root_origin (GdkWindow *window,
&root, &xparent,
&children, &nchildren))
return;
-
+
if (children)
XFree (children);
}
while (xparent != root);
-
+
if (xparent == root)
{
unsigned int ww, wh, wb, wd;
int wx, wy;
-
+
if (XGetGeometry (private->xdisplay, xwindow, &root, &wx, &wy, &ww, &wh, &wb, &wd))
{
if (x)
@@ -1617,12 +1617,12 @@ gdk_window_get_pointer (GdkWindow *window,
int winx = 0;
int winy = 0;
unsigned int xmask = 0;
-
+
if (!window)
window = (GdkWindow*) &gdk_root_parent;
-
+
private = (GdkWindowPrivate*) window;
-
+
return_val = NULL;
if (!private->destroyed &&
XQueryPointer (private->xdisplay, private->xwindow, &root, &child,
@@ -1654,11 +1654,11 @@ gdk_window_at_pointer (gint *win_x,
int rootx = -1, rooty = -1;
int winx, winy;
unsigned int xmask;
-
+
private = &gdk_root_parent;
-
+
xwindow = private->xwindow;
-
+
XGrabServer (private->xdisplay);
while (xwindow)
{
@@ -1673,12 +1673,12 @@ gdk_window_at_pointer (gint *win_x,
XUngrabServer (private->xdisplay);
window = gdk_window_lookup (xwindow_last);
-
+
if (win_x)
*win_x = window ? winx : -1;
if (win_y)
*win_y = window ? winy : -1;
-
+
return window;
}
@@ -1686,7 +1686,7 @@ GdkWindow*
gdk_window_get_parent (GdkWindow *window)
{
g_return_val_if_fail (window != NULL, NULL);
-
+
return ((GdkWindowPrivate*) window)->parent;
}
@@ -1694,17 +1694,17 @@ GdkWindow*
gdk_window_get_toplevel (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_val_if_fail (window != NULL, NULL);
-
+
private = (GdkWindowPrivate*) window;
-
+
while (private->window_type == GDK_WINDOW_CHILD)
{
window = ((GdkWindowPrivate*) window)->parent;
private = (GdkWindowPrivate*) window;
}
-
+
return window;
}
@@ -1719,18 +1719,18 @@ gdk_window_get_children (GdkWindow *window)
Window *xchildren;
unsigned int nchildren;
unsigned int i;
-
+
g_return_val_if_fail (window != NULL, NULL);
-
+
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return NULL;
-
+
XQueryTree (private->xdisplay, private->xwindow,
&root, &parent, &xchildren, &nchildren);
-
+
children = NULL;
-
+
if (nchildren > 0)
{
for (i = 0; i < nchildren; i++)
@@ -1739,55 +1739,55 @@ gdk_window_get_children (GdkWindow *window)
if (child)
children = g_list_prepend (children, child);
}
-
+
if (xchildren)
XFree (xchildren);
}
-
+
return children;
}
GdkEventMask
-gdk_window_get_events (GdkWindow *window)
+gdk_window_get_events (GdkWindow *window)
{
GdkWindowPrivate *private;
XWindowAttributes attrs;
GdkEventMask event_mask;
int i;
-
+
g_return_val_if_fail (window != NULL, 0);
-
+
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return 0;
-
+
XGetWindowAttributes (gdk_display, private->xwindow,
&attrs);
-
+
event_mask = 0;
for (i = 0; i < gdk_nevent_masks; i++)
{
if (attrs.your_event_mask & gdk_event_mask_table[i])
event_mask |= 1 << (i + 1);
}
-
+
return event_mask;
}
void
-gdk_window_set_events (GdkWindow *window,
- GdkEventMask event_mask)
+gdk_window_set_events (GdkWindow *window,
+ GdkEventMask event_mask)
{
GdkWindowPrivate *private;
long xevent_mask;
int i;
-
+
g_return_if_fail (window != NULL);
-
+
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return;
-
+
xevent_mask = StructureNotifyMask;
for (i = 0; i < gdk_nevent_masks; i++)
{
@@ -1808,15 +1808,15 @@ gdk_window_add_colormap_windows (GdkWindow *window)
Window *old_windows;
Window *new_windows;
int i, count;
-
+
g_return_if_fail (window != NULL);
-
+
toplevel = gdk_window_get_toplevel (window);
toplevel_private = (GdkWindowPrivate*) toplevel;
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return;
-
+
old_windows = NULL;
if (!XGetWMColormapWindows (toplevel_private->xdisplay,
toplevel_private->xwindow,
@@ -1824,24 +1824,24 @@ gdk_window_add_colormap_windows (GdkWindow *window)
{
count = 0;
}
-
+
for (i = 0; i < count; i++)
if (old_windows[i] == window_private->xwindow)
{
XFree (old_windows);
return;
}
-
+
new_windows = g_new (Window, count + 1);
-
+
for (i = 0; i < count; i++)
new_windows[i] = old_windows[i];
new_windows[count] = window_private->xwindow;
-
+
XSetWMColormapWindows (toplevel_private->xdisplay,
toplevel_private->xwindow,
new_windows, count + 1);
-
+
g_free (new_windows);
if (old_windows)
XFree (old_windows);
@@ -1852,16 +1852,16 @@ gdk_window_have_shape_ext (void)
{
enum { UNKNOWN, NO, YES };
static gint have_shape = UNKNOWN;
-
+
if (have_shape == UNKNOWN)
{
int ignore;
- if (XQueryExtension(gdk_display, "SHAPE", &ignore, &ignore, &ignore))
+ if (XQueryExtension (gdk_display, "SHAPE", &ignore, &ignore, &ignore))
have_shape = YES;
else
have_shape = NO;
}
-
+
return (have_shape == YES);
}
@@ -1877,15 +1877,15 @@ gdk_window_shape_combine_mask (GdkWindow *window,
{
GdkWindowPrivate *window_private;
Pixmap pixmap;
-
+
g_return_if_fail (window != NULL);
-
+
#ifdef HAVE_SHAPE_EXT
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return;
-
- if (gdk_window_have_shape_ext())
+
+ if (gdk_window_have_shape_ext ())
{
if (mask)
{
@@ -1901,34 +1901,34 @@ gdk_window_shape_combine_mask (GdkWindow *window,
pixmap = None;
}
- XShapeCombineMask (window_private->xdisplay,
- window_private->xwindow,
- ShapeBounding,
- x, y,
- pixmap,
- ShapeSet);
+ XShapeCombineMask (window_private->xdisplay,
+ window_private->xwindow,
+ ShapeBounding,
+ x, y,
+ pixmap,
+ ShapeSet);
}
#endif /* HAVE_SHAPE_EXT */
}
void
-gdk_window_add_filter (GdkWindow *window,
- GdkFilterFunc function,
- gpointer data)
+gdk_window_add_filter (GdkWindow *window,
+ GdkFilterFunc function,
+ gpointer data)
{
GdkWindowPrivate *private;
GList *tmp_list;
GdkEventFilter *filter;
-
+
private = (GdkWindowPrivate*) window;
if (private && private->destroyed)
return;
-
- if(private)
+
+ if (private)
tmp_list = private->filters;
else
tmp_list = gdk_default_filters;
-
+
while (tmp_list)
{
filter = (GdkEventFilter *)tmp_list->data;
@@ -1936,42 +1936,42 @@ gdk_window_add_filter (GdkWindow *window,
return;
tmp_list = tmp_list->next;
}
-
+
filter = g_new (GdkEventFilter, 1);
filter->function = function;
filter->data = data;
-
- if(private)
+
+ if (private)
private->filters = g_list_append (private->filters, filter);
else
gdk_default_filters = g_list_append (gdk_default_filters, filter);
}
void
-gdk_window_remove_filter (GdkWindow *window,
- GdkFilterFunc function,
- gpointer data)
+gdk_window_remove_filter (GdkWindow *window,
+ GdkFilterFunc function,
+ gpointer data)
{
GdkWindowPrivate *private;
GList *tmp_list, *node;
GdkEventFilter *filter;
-
+
private = (GdkWindowPrivate*) window;
-
- if(private)
+
+ if (private)
tmp_list = private->filters;
else
tmp_list = gdk_default_filters;
-
+
while (tmp_list)
{
filter = (GdkEventFilter *)tmp_list->data;
node = tmp_list;
tmp_list = tmp_list->next;
-
+
if ((filter->function == function) && (filter->data == data))
{
- if(private)
+ if (private)
private->filters = g_list_remove_link (private->filters, node);
else
gdk_default_filters = g_list_remove_link (gdk_default_filters, tmp_list);
@@ -1984,39 +1984,39 @@ gdk_window_remove_filter (GdkWindow *window,
}
void
-gdk_window_set_override_redirect(GdkWindow *window,
- gboolean override_redirect)
+gdk_window_set_override_redirect (GdkWindow *window,
+ gboolean override_redirect)
{
GdkWindowPrivate *private;
XSetWindowAttributes attr;
-
+
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return;
-
+
attr.override_redirect = (override_redirect == FALSE)?False:True;
- XChangeWindowAttributes(gdk_display,
- ((GdkWindowPrivate *)window)->xwindow,
- CWOverrideRedirect,
- &attr);
+ XChangeWindowAttributes (gdk_display,
+ ((GdkWindowPrivate *)window)->xwindow,
+ CWOverrideRedirect,
+ &attr);
}
void
-gdk_window_set_icon (GdkWindow *window,
- GdkWindow *icon_window,
- GdkPixmap *pixmap,
- GdkBitmap *mask)
+gdk_window_set_icon (GdkWindow *window,
+ GdkWindow *icon_window,
+ GdkPixmap *pixmap,
+ GdkBitmap *mask)
{
XWMHints wm_hints;
GdkWindowPrivate *window_private;
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return;
-
+
wm_hints.flags = 0;
if (icon_window != NULL)
@@ -2025,32 +2025,32 @@ gdk_window_set_icon (GdkWindow *window,
wm_hints.flags |= IconWindowHint;
wm_hints.icon_window = private->xwindow;
}
-
+
if (pixmap != NULL)
{
private = (GdkWindowPrivate *)pixmap;
wm_hints.flags |= IconPixmapHint;
wm_hints.icon_pixmap = private->xwindow;
}
-
+
if (mask != NULL)
{
private = (GdkWindowPrivate *)mask;
wm_hints.flags |= IconMaskHint;
wm_hints.icon_mask = private->xwindow;
}
-
+
XSetWMHints (window_private->xdisplay, window_private->xwindow, &wm_hints);
}
void
-gdk_window_set_icon_name (GdkWindow *window,
- gchar * name)
+gdk_window_set_icon_name (GdkWindow *window,
+ gchar * name)
{
GdkWindowPrivate *window_private;
XTextProperty property;
gint res;
-
+
g_return_if_fail (window != NULL);
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
@@ -2060,35 +2060,35 @@ gdk_window_set_icon_name (GdkWindow *window,
&property);
if (res < 0)
{
- g_warning("Error converting icon name to text property: %d\n", res);
+ g_warning ("Error converting icon name to text property: %d\n", res);
return;
}
-
+
XSetWMIconName (window_private->xdisplay, window_private->xwindow,
&property);
-
+
if (property.value)
XFree (property.value);
}
void
-gdk_window_set_group (GdkWindow *window,
- GdkWindow *leader)
+gdk_window_set_group (GdkWindow *window,
+ GdkWindow *leader)
{
XWMHints wm_hints;
GdkWindowPrivate *window_private;
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
g_return_if_fail (leader != NULL);
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return;
-
+
private = (GdkWindowPrivate *)leader;
wm_hints.flags = WindowGroupHint;
wm_hints.window_group = private->xwindow;
-
+
XSetWMHints (window_private->xdisplay, window_private->xwindow, &wm_hints);
}
@@ -2102,23 +2102,23 @@ gdk_window_set_mwm_hints (GdkWindow *window,
gint format;
gulong nitems;
gulong bytes_after;
-
+
GdkWindowPrivate *window_private;
-
+
g_return_if_fail (window != NULL);
window_private = (GdkWindowPrivate*) window;
if (window_private->destroyed)
return;
-
+
if (!hints_atom)
hints_atom = XInternAtom (window_private->xdisplay,
_XA_MOTIF_WM_HINTS, FALSE);
XGetWindowProperty (window_private->xdisplay, window_private->xwindow,
- hints_atom, 0, sizeof(MotifWmHints)/4,
+ hints_atom, 0, sizeof (MotifWmHints)/4,
False, AnyPropertyType, &type, &format, &nitems,
&bytes_after, (guchar **)&hints);
-
+
if (type == None)
hints = new_hints;
else
@@ -2134,11 +2134,11 @@ gdk_window_set_mwm_hints (GdkWindow *window,
hints->decorations = new_hints->decorations;
}
}
-
+
XChangeProperty (window_private->xdisplay, window_private->xwindow,
hints_atom, hints_atom, 32, PropModeReplace,
- (guchar *)hints, sizeof(MotifWmHints)/4);
-
+ (guchar *)hints, sizeof (MotifWmHints)/4);
+
if (hints != new_hints)
XFree (hints);
}
@@ -2148,10 +2148,10 @@ gdk_window_set_decorations (GdkWindow *window,
GdkWMDecoration decorations)
{
MotifWmHints hints;
-
+
hints.flags = MWM_HINTS_DECORATIONS;
hints.decorations = decorations;
-
+
gdk_window_set_mwm_hints (window, &hints);
}
@@ -2160,10 +2160,10 @@ gdk_window_set_functions (GdkWindow *window,
GdkWMFunction functions)
{
MotifWmHints hints;
-
+
hints.flags = MWM_HINTS_FUNCTIONS;
hints.functions = functions;
-
+
gdk_window_set_mwm_hints (window, &hints);
}
@@ -2172,14 +2172,14 @@ gdk_window_get_toplevels (void)
{
GList *new_list = NULL;
GList *tmp_list;
-
+
tmp_list = gdk_root_parent.children;
while (tmp_list)
{
new_list = g_list_prepend (new_list, tmp_list->data);
tmp_list = tmp_list->next;
}
-
+
return new_list;
}
@@ -2192,147 +2192,154 @@ gdk_window_get_toplevels (void)
struct _gdk_span
{
- gint start;
- gint end;
- struct _gdk_span *next;
+ gint start;
+ gint end;
+ struct _gdk_span *next;
};
static void
-gdk_add_to_span(struct _gdk_span **s, int x, int xx)
-{
- struct _gdk_span *ptr1, *ptr2, *noo, *ss;
- gchar spanning;
-
- ptr2 = NULL;
- ptr1 = *s;
- spanning = 0;
- ss = NULL;
- /* scan the spans for this line */
- while (ptr1)
- {
- /* -- -> new span */
- /* == -> existing span */
- /* ## -> spans intersect */
- /* if we are in the middle of spanning the span into the line */
- if (spanning)
- {
- /* case: ---- ==== */
- if (xx < ptr1->start - 1)
- {
- /* ends before next span - extend to here */
- ss->end = xx;
- return;
- }
- /* case: ----##=== */
- else if (xx <= ptr1->end)
- {
- /* crosses into next span - delete next span and append */
- ss->end = ptr1->end;
- ss->next = ptr1->next;
- g_free(ptr1);
- return;
- }
- /* case: ---###--- */
- else
- {
- /* overlaps next span - delete and keep checking */
- ss->next = ptr1->next;
- g_free(ptr1);
- ptr1 = ss;
- }
- }
- /* otherwise havent started spanning it in yet */
- else
- {
- /* case: ---- ==== */
- if (xx < ptr1->start - 1)
- {
- /* insert span here in list */
- noo = g_malloc(sizeof(struct _gdk_span));
-
- if (noo)
- {
- noo->start = x;
- noo->end = xx;
- noo->next = ptr1;
- if (ptr2)
- ptr2->next = noo;
- else
- *s = noo;
- }
- return;
- }
- /* case: ----##=== */
- else if ((x < ptr1->start) && (xx <= ptr1->end))
- {
- /* expand this span to the left point of the new one */
- ptr1->start = x;
- return;
- }
- /* case: ===###=== */
- else if ((x >= ptr1->start) && (xx <= ptr1->end))
- {
- /* throw the span away */
- return;
- }
- /* case: ---###--- */
- else if ((x < ptr1->start) && (xx > ptr1->end))
- {
- ss = ptr1;
- spanning = 1;
- ptr1->start = x;
- ptr1->end = xx;
- }
- /* case: ===##---- */
- else if ((x >= ptr1->start) && (x <= ptr1->end + 1) && (xx > ptr1->end))
- {
- ss = ptr1;
- spanning = 1;
- ptr1->end = xx;
- }
- /* case: ==== ---- */
- /* case handled by next loop iteration - first case */
- }
- ptr2 = ptr1;
- ptr1 = ptr1->next;
- }
- /* it started in the middle but spans beyond your current list */
- if (spanning)
- {
- ptr2->end = xx;
- return;
- }
- /* it does not start inside a span or in the middle, so add it to the end */
- noo = g_malloc(sizeof(struct _gdk_span));
-
- if (noo)
- {
- noo->start = x;
- noo->end = xx;
- if (ptr2)
- {
- noo->next = ptr2->next;
- ptr2->next = noo;
- }
- else
- {
- noo->next = NULL;
- *s = noo;
- }
- }
- return;
+gdk_add_to_span (struct _gdk_span **s,
+ gint x,
+ gint xx)
+{
+ struct _gdk_span *ptr1, *ptr2, *noo, *ss;
+ gchar spanning;
+
+ ptr2 = NULL;
+ ptr1 = *s;
+ spanning = 0;
+ ss = NULL;
+ /* scan the spans for this line */
+ while (ptr1)
+ {
+ /* -- -> new span */
+ /* == -> existing span */
+ /* ## -> spans intersect */
+ /* if we are in the middle of spanning the span into the line */
+ if (spanning)
+ {
+ /* case: ---- ==== */
+ if (xx < ptr1->start - 1)
+ {
+ /* ends before next span - extend to here */
+ ss->end = xx;
+ return;
+ }
+ /* case: ----##=== */
+ else if (xx <= ptr1->end)
+ {
+ /* crosses into next span - delete next span and append */
+ ss->end = ptr1->end;
+ ss->next = ptr1->next;
+ g_free (ptr1);
+ return;
+ }
+ /* case: ---###--- */
+ else
+ {
+ /* overlaps next span - delete and keep checking */
+ ss->next = ptr1->next;
+ g_free (ptr1);
+ ptr1 = ss;
+ }
+ }
+ /* otherwise havent started spanning it in yet */
+ else
+ {
+ /* case: ---- ==== */
+ if (xx < ptr1->start - 1)
+ {
+ /* insert span here in list */
+ noo = g_malloc (sizeof (struct _gdk_span));
+
+ if (noo)
+ {
+ noo->start = x;
+ noo->end = xx;
+ noo->next = ptr1;
+ if (ptr2)
+ ptr2->next = noo;
+ else
+ *s = noo;
+ }
+ return;
+ }
+ /* case: ----##=== */
+ else if ((x < ptr1->start) && (xx <= ptr1->end))
+ {
+ /* expand this span to the left point of the new one */
+ ptr1->start = x;
+ return;
+ }
+ /* case: ===###=== */
+ else if ((x >= ptr1->start) && (xx <= ptr1->end))
+ {
+ /* throw the span away */
+ return;
+ }
+ /* case: ---###--- */
+ else if ((x < ptr1->start) && (xx > ptr1->end))
+ {
+ ss = ptr1;
+ spanning = 1;
+ ptr1->start = x;
+ ptr1->end = xx;
+ }
+ /* case: ===##---- */
+ else if ((x >= ptr1->start) && (x <= ptr1->end + 1) && (xx > ptr1->end))
+ {
+ ss = ptr1;
+ spanning = 1;
+ ptr1->end = xx;
+ }
+ /* case: ==== ---- */
+ /* case handled by next loop iteration - first case */
+ }
+ ptr2 = ptr1;
+ ptr1 = ptr1->next;
+ }
+ /* it started in the middle but spans beyond your current list */
+ if (spanning)
+ {
+ ptr2->end = xx;
+ return;
+ }
+ /* it does not start inside a span or in the middle, so add it to the end */
+ noo = g_malloc (sizeof (struct _gdk_span));
+
+ if (noo)
+ {
+ noo->start = x;
+ noo->end = xx;
+ if (ptr2)
+ {
+ noo->next = ptr2->next;
+ ptr2->next = noo;
+ }
+ else
+ {
+ noo->next = NULL;
+ *s = noo;
+ }
+ }
+ return;
}
static void
-gdk_add_rectangles (Display *disp, Window win, struct _gdk_span **spans,
- gint basew, gint baseh, gint x, gint y)
+gdk_add_rectangles (Display *disp,
+ Window win,
+ struct _gdk_span **spans,
+ gint basew,
+ gint baseh,
+ gint x,
+ gint y)
{
gint a, k;
gint x1, y1, x2, y2;
gint rn, ord;
XRectangle *rl;
-
- rl = XShapeGetRectangles(disp, win, ShapeBounding, &rn, &ord);
+
+ rl = XShapeGetRectangles (disp, win, ShapeBounding, &rn, &ord);
if (rl)
{
/* go through all clip rects in this window's shape */
@@ -2354,152 +2361,154 @@ gdk_add_rectangles (Display *disp, Window win, struct _gdk_span **spans,
for (a = y1; a <= y2; a++)
{
if ((x2 - x1) >= 0)
- gdk_add_to_span(&spans[a], x1, x2);
+ gdk_add_to_span (&spans[a], x1, x2);
}
}
- XFree(rl);
+ XFree (rl);
}
}
static void
-gdk_propagate_shapes(Display *disp, Window win, gboolean merge)
-{
- Window rt, par, *list = NULL;
- gint i, j, num = 0, num_rects = 0;
- gint x, y, contig;
- guint w, h, d;
- gint baseh, basew;
- XRectangle *rects = NULL;
- struct _gdk_span **spans = NULL, *ptr1, *ptr2, *ptr3;
- XWindowAttributes xatt;
-
- XGetGeometry(disp, win, &rt, &x, &y, &w, &h, &d, &d);
- if (h <= 0)
- return;
- basew = w;
- baseh = h;
- spans = g_malloc(sizeof(struct _gdk_span *) * h);
-
- for (i = 0; i < h; i++)
- spans[i] = NULL;
- XQueryTree(disp, win, &rt, &par, &list, (unsigned int *)&num);
- if (list)
- {
- /* go through all child windows and create/insert spans */
- for (i = 0; i < num; i++)
- {
- if (XGetWindowAttributes(disp, list[i], &xatt) && (xatt.map_state != IsUnmapped))
- if (XGetGeometry(disp, list[i], &rt, &x, &y, &w, &h, &d, &d))
- gdk_add_rectangles (disp, list[i], spans, basew, baseh, x, y);
- }
- if (merge)
- gdk_add_rectangles (disp, win, spans, basew, baseh, x, y);
-
- /* go through the spans list and build a list of rects */
- rects = g_malloc(sizeof(XRectangle) * 256);
- num_rects = 0;
- for (i = 0; i < baseh; i++)
- {
- ptr1 = spans[i];
- /* go through the line for all spans */
- while (ptr1)
- {
- rects[num_rects].x = ptr1->start;
- rects[num_rects].y = i;
- rects[num_rects].width = ptr1->end - ptr1->start + 1;
- rects[num_rects].height = 1;
- j = i + 1;
- /* if there are more lines */
- contig = 1;
- /* while contigous rects (same start/end coords) exist */
- while ((contig) && (j < baseh))
+gdk_propagate_shapes (Display *disp,
+ Window win,
+ gboolean merge)
+{
+ Window rt, par, *list = NULL;
+ gint i, j, num = 0, num_rects = 0;
+ gint x, y, contig;
+ guint w, h, d;
+ gint baseh, basew;
+ XRectangle *rects = NULL;
+ struct _gdk_span **spans = NULL, *ptr1, *ptr2, *ptr3;
+ XWindowAttributes xatt;
+
+ XGetGeometry (disp, win, &rt, &x, &y, &w, &h, &d, &d);
+ if (h <= 0)
+ return;
+ basew = w;
+ baseh = h;
+ spans = g_malloc (sizeof (struct _gdk_span *) * h);
+
+ for (i = 0; i < h; i++)
+ spans[i] = NULL;
+ XQueryTree (disp, win, &rt, &par, &list, (unsigned int *)&num);
+ if (list)
+ {
+ /* go through all child windows and create/insert spans */
+ for (i = 0; i < num; i++)
+ {
+ if (XGetWindowAttributes (disp, list[i], &xatt) && (xatt.map_state != IsUnmapped))
+ if (XGetGeometry (disp, list[i], &rt, &x, &y, &w, &h, &d, &d))
+ gdk_add_rectangles (disp, list[i], spans, basew, baseh, x, y);
+ }
+ if (merge)
+ gdk_add_rectangles (disp, win, spans, basew, baseh, x, y);
+
+ /* go through the spans list and build a list of rects */
+ rects = g_malloc (sizeof (XRectangle) * 256);
+ num_rects = 0;
+ for (i = 0; i < baseh; i++)
+ {
+ ptr1 = spans[i];
+ /* go through the line for all spans */
+ while (ptr1)
+ {
+ rects[num_rects].x = ptr1->start;
+ rects[num_rects].y = i;
+ rects[num_rects].width = ptr1->end - ptr1->start + 1;
+ rects[num_rects].height = 1;
+ j = i + 1;
+ /* if there are more lines */
+ contig = 1;
+ /* while contigous rects (same start/end coords) exist */
+ while ((contig) && (j < baseh))
+ {
+ /* search next line for spans matching this one */
+ contig = 0;
+ ptr2 = spans[j];
+ ptr3 = NULL;
+ while (ptr2)
{
- /* search next line for spans matching this one */
- contig = 0;
- ptr2 = spans[j];
- ptr3 = NULL;
- while (ptr2)
- {
- /* if we have an exact span match set contig */
- if ((ptr2->start == ptr1->start) &&
- (ptr2->end == ptr1->end))
- {
- contig = 1;
- /* remove the span - not needed */
- if (ptr3)
- {
- ptr3->next = ptr2->next;
- g_free(ptr2);
- ptr2 = NULL;
- }
- else
- {
- spans[j] = ptr2->next;
- g_free(ptr2);
- ptr2 = NULL;
- }
- break;
- }
- /* gone past the span point no point looking */
- else if (ptr2->start < ptr1->start)
- break;
- if (ptr2)
- {
- ptr3 = ptr2;
- ptr2 = ptr2->next;
- }
- }
- /* if a contiguous span was found increase the rect h */
- if (contig)
- {
- rects[num_rects].height++;
- j++;
- }
+ /* if we have an exact span match set contig */
+ if ((ptr2->start == ptr1->start) &&
+ (ptr2->end == ptr1->end))
+ {
+ contig = 1;
+ /* remove the span - not needed */
+ if (ptr3)
+ {
+ ptr3->next = ptr2->next;
+ g_free (ptr2);
+ ptr2 = NULL;
+ }
+ else
+ {
+ spans[j] = ptr2->next;
+ g_free (ptr2);
+ ptr2 = NULL;
+ }
+ break;
+ }
+ /* gone past the span point no point looking */
+ else if (ptr2->start < ptr1->start)
+ break;
+ if (ptr2)
+ {
+ ptr3 = ptr2;
+ ptr2 = ptr2->next;
+ }
}
- /* up the rect count */
- num_rects++;
- /* every 256 new rects increase the rect array */
- if ((num_rects % 256) == 0)
- rects = g_realloc(rects, sizeof(XRectangle) * (num_rects + 256));
- ptr1 = ptr1->next;
- }
- }
- /* set the rects as the shape mask */
- if (rects)
- {
- XShapeCombineRectangles(disp, win, ShapeBounding, 0, 0, rects, num_rects,
- ShapeSet, YXSorted);
- g_free(rects);
- }
- XFree(list);
- }
- /* free up all the spans we made */
- for (i = 0; i < baseh; i++)
- {
- ptr1 = spans[i];
- while (ptr1)
- {
- ptr2 = ptr1;
- ptr1 = ptr1->next;
- g_free(ptr2);
- }
- }
- g_free(spans);
+ /* if a contiguous span was found increase the rect h */
+ if (contig)
+ {
+ rects[num_rects].height++;
+ j++;
+ }
+ }
+ /* up the rect count */
+ num_rects++;
+ /* every 256 new rects increase the rect array */
+ if ((num_rects % 256) == 0)
+ rects = g_realloc (rects, sizeof (XRectangle) * (num_rects + 256));
+ ptr1 = ptr1->next;
+ }
+ }
+ /* set the rects as the shape mask */
+ if (rects)
+ {
+ XShapeCombineRectangles (disp, win, ShapeBounding, 0, 0, rects, num_rects,
+ ShapeSet, YXSorted);
+ g_free (rects);
+ }
+ XFree (list);
+ }
+ /* free up all the spans we made */
+ for (i = 0; i < baseh; i++)
+ {
+ ptr1 = spans[i];
+ while (ptr1)
+ {
+ ptr2 = ptr1;
+ ptr1 = ptr1->next;
+ g_free (ptr2);
+ }
+ }
+ g_free (spans);
}
void
gdk_window_set_child_shapes (GdkWindow *window)
{
GdkWindowPrivate *private;
-
+
g_return_if_fail (window != NULL);
-
+
#ifdef HAVE_SHAPE_EXT
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return;
-
- if (gdk_window_have_shape_ext())
+
+ if (gdk_window_have_shape_ext ())
gdk_propagate_shapes (private->xdisplay, private->xwindow, FALSE);
#endif
}
@@ -2515,8 +2524,8 @@ gdk_window_merge_child_shapes (GdkWindow *window)
private = (GdkWindowPrivate*) window;
if (private->destroyed)
return;
-
- if (gdk_window_have_shape_ext())
+
+ if (gdk_window_have_shape_ext ())
gdk_propagate_shapes (private->xdisplay, private->xwindow, TRUE);
#endif
}
@@ -2534,9 +2543,9 @@ gboolean
gdk_window_is_visible (GdkWindow *window)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-
+
g_return_val_if_fail (window != NULL, FALSE);
-
+
return private->mapped;
}
@@ -2556,19 +2565,19 @@ gboolean
gdk_window_is_viewable (GdkWindow *window)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
-
+
g_return_val_if_fail (window != NULL, FALSE);
-
+
while (private &&
(private != &gdk_root_parent) &&
(private->window_type != GDK_WINDOW_FOREIGN))
{
if (!private->mapped)
return FALSE;
-
+
private = (GdkWindowPrivate *)private->parent;
}
-
+
return TRUE;
}
@@ -2591,7 +2600,7 @@ gdk_window_gravity_works (void)
{
enum { UNKNOWN, NO, YES };
static gint gravity_works = UNKNOWN;
-
+
if (gravity_works == UNKNOWN)
{
GdkWindowAttr attr;
@@ -2621,7 +2630,7 @@ gdk_window_gravity_works (void)
attr.window_type = GDK_WINDOW_CHILD;
child = gdk_window_new (parent, &attr, GDK_WA_X | GDK_WA_Y);
-
+
gdk_window_set_static_win_gravity (child, TRUE);
gdk_window_resize (parent, 100, 110);
@@ -2636,10 +2645,10 @@ gdk_window_gravity_works (void)
gdk_window_destroy (parent);
gdk_window_destroy (child);
-
+
gravity_works = ((y == -20) ? YES : NO);
}
-
+
return (gravity_works == YES);
}
@@ -2648,9 +2657,9 @@ gdk_window_set_static_bit_gravity (GdkWindow *window, gboolean on)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
XSetWindowAttributes xattributes;
-
+
g_return_if_fail (window != NULL);
-
+
xattributes.bit_gravity = on ? StaticGravity : ForgetGravity;
XChangeWindowAttributes (private->xdisplay,
private->xwindow,
@@ -2662,11 +2671,11 @@ gdk_window_set_static_win_gravity (GdkWindow *window, gboolean on)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
XSetWindowAttributes xattributes;
-
+
g_return_if_fail (window != NULL);
-
+
xattributes.win_gravity = on ? StaticGravity : NorthWestGravity;
-
+
XChangeWindowAttributes (private->xdisplay,
private->xwindow,
CWWinGravity, &xattributes);
@@ -2690,7 +2699,7 @@ gdk_window_set_static_gravities (GdkWindow *window,
{
GdkWindowPrivate *private = (GdkWindowPrivate *)window;
GList *tmp_list;
-
+
g_return_val_if_fail (window != NULL, FALSE);
if (!use_static == !private->guffaw_gravity)
@@ -2698,11 +2707,11 @@ gdk_window_set_static_gravities (GdkWindow *window,
if (use_static && !gdk_window_gravity_works ())
return FALSE;
-
+
private->guffaw_gravity = use_static;
-
+
gdk_window_set_static_bit_gravity (window, use_static);
-
+
tmp_list = private->children;
while (tmp_list)
{
@@ -2710,6 +2719,6 @@ gdk_window_set_static_gravities (GdkWindow *window,
tmp_list = tmp_list->next;
}
-
+
return TRUE;
}
diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c
index 0bb87f70b..819ad8154 100644
--- a/gtk/gtkcolorsel.c
+++ b/gtk/gtkcolorsel.c
@@ -151,6 +151,9 @@ static void gtk_color_selection_sample_resize (GtkWidget *widget,
static void gtk_color_selection_drag_begin (GtkWidget *widget,
GdkDragContext *context,
gpointer data);
+static void gtk_color_selection_drag_end (GtkWidget *widget,
+ GdkDragContext *context,
+ gpointer data);
static void gtk_color_selection_drop_handle (GtkWidget *widget,
GdkDragContext *context,
gint x,
@@ -547,6 +550,10 @@ gtk_color_selection_realize (GtkWidget *widget)
GTK_SIGNAL_FUNC (gtk_color_selection_drag_begin),
colorsel);
gtk_signal_connect (GTK_OBJECT (colorsel->sample_area),
+ "drag_end",
+ GTK_SIGNAL_FUNC (gtk_color_selection_drag_end),
+ colorsel);
+ gtk_signal_connect (GTK_OBJECT (colorsel->sample_area),
"drag_data_get",
GTK_SIGNAL_FUNC (gtk_color_selection_drag_handle),
colorsel);
@@ -863,10 +870,14 @@ gtk_color_selection_drag_begin (GtkWidget *widget,
gdouble colors[4];
GdkColor bg;
- window = gtk_window_new(GTK_WINDOW_POPUP);
+ window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
gtk_widget_set_usize (window, 48, 32);
gtk_widget_realize (window);
+ gtk_object_set_data_full (GTK_OBJECT (widget),
+ "gtk-color-selection-drag-window",
+ window,
+ (GtkDestroyNotify) gtk_widget_destroy);
gtk_color_selection_get_color (colorsel, colors);
bg.red = 0xffff * colors[0];
@@ -880,6 +891,14 @@ gtk_color_selection_drag_begin (GtkWidget *widget,
}
static void
+gtk_color_selection_drag_end (GtkWidget *widget,
+ GdkDragContext *context,
+ gpointer data)
+{
+ gtk_object_set_data (GTK_OBJECT (widget), "gtk-color-selection-drag-window", NULL);
+}
+
+static void
gtk_color_selection_drop_handle (GtkWidget *widget,
GdkDragContext *context,
gint x,
@@ -1219,19 +1238,16 @@ static void
gtk_color_selection_draw_value_bar (GtkColorSelection *colorsel,
gint resize)
{
- gint x, y, i, wid, heig, n;
- gdouble sv, v, c[3];
- guchar rc[3];
+ gint x, y, wid, heig, n;
+ gdouble sv, v;
wid = colorsel->value_area->allocation.width;
heig = colorsel->value_area->allocation.height;
- if (resize)
+ if (resize || !colorsel->value_buf)
{
- if (colorsel->value_buf != NULL)
- g_free (colorsel->value_buf);
-
- colorsel->value_buf = g_new(guchar, 3 * wid);
+ g_free (colorsel->value_buf);
+ colorsel->value_buf = g_new0 (guchar, 3 * wid);
}
v = 1.0;
@@ -1239,9 +1255,13 @@ gtk_color_selection_draw_value_bar (GtkColorSelection *colorsel,
for (y = 0; y < heig; y++)
{
- i = 0;
+ gdouble c[3];
+ guchar rc[3];
+ gint i = 0;
- gtk_color_selection_hsv_to_rgb (colorsel->values[HUE],colorsel->values[SATURATION],v,
+ gtk_color_selection_hsv_to_rgb (colorsel->values[HUE],
+ colorsel->values[SATURATION],
+ v,
&c[0], &c[1], &c[2]);
for (n = 0; n < 3; n++)
@@ -1359,9 +1379,9 @@ gtk_color_selection_draw_wheel (GtkColorSelection *colorsel,
FALSE, 1, 1, w - 1, h - 1, 210 * 64, 180 * 64);
gdk_draw_arc (pm, pmgc,
FALSE, 0, 0, w, h, 210 * 64, 180 * 64);
- gdk_window_shape_combine_mask(colorsel->wheel_area->window, pm, 0, 0);
- gdk_pixmap_unref(pm);
- gdk_gc_destroy(pmgc);
+ gdk_window_shape_combine_mask (colorsel->wheel_area->window, pm, 0, 0);
+ gdk_pixmap_unref (pm);
+ gdk_gc_destroy (pmgc);
}
}
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 6e4adfff6..8d819bc95 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -36,26 +36,29 @@ typedef struct _GtkDragAnim GtkDragAnim;
typedef struct _GtkDragFindData GtkDragFindData;
-typedef enum {
+typedef enum
+{
GTK_DRAG_STATUS_DRAG,
GTK_DRAG_STATUS_WAIT,
GTK_DRAG_STATUS_DROP
} GtkDragStatus;
-struct _GtkDragSourceSite {
+struct _GtkDragSourceSite
+{
GdkModifierType start_button_mask;
GtkTargetList *target_list; /* Targets for drag data */
GdkDragAction actions; /* Possible actions */
GdkColormap *colormap; /* Colormap for drag icon */
GdkPixmap *pixmap; /* Icon for drag data */
GdkBitmap *mask;
-
+
/* Stored button press information to detect drag beginning */
gint state;
gint x, y;
};
-
-struct _GtkDragSourceInfo {
+
+struct _GtkDragSourceInfo
+{
GtkWidget *widget;
GtkTargetList *target_list; /* Targets for drag data */
GdkDragAction possible_actions; /* Actions allowed by source */
@@ -65,21 +68,22 @@ struct _GtkDragSourceInfo {
GdkCursor *cursor; /* Cursor for drag */
gint hot_x, hot_y; /* Hot spot for drag */
gint button; /* mouse button starting drag */
-
+
GtkDragStatus status; /* drag status */
GdkEvent *last_event; /* motion event waiting for response */
-
+
gint start_x, start_y; /* Initial position */
gint cur_x, cur_y; /* Current Position */
-
+
GList *selections; /* selections we've claimed */
GtkDragDestInfo *proxy_dest; /* Set if this is a proxy drag */
-
+
guint drop_timeout; /* Timeout for aborting drop */
};
-struct _GtkDragDestSite {
+struct _GtkDragDestSite
+{
GtkDestDefaults flags;
GtkTargetList *target_list;
GdkDragAction actions;
@@ -89,8 +93,9 @@ struct _GtkDragDestSite {
gboolean proxy_coords : 1;
gboolean have_drag : 1;
};
-
-struct _GtkDragDestInfo {
+
+struct _GtkDragDestInfo
+{
GtkWidget *widget; /* Widget in which drag is in */
GdkDragContext *context; /* Drag context */
GtkDragSourceInfo *proxy_source; /* Set if this is a proxy drag */
@@ -111,13 +116,15 @@ struct _GtkDragDestInfo {
#define ANIM_MIN_STEPS 5
#define ANIM_MAX_STEPS 10
-struct _GtkDragAnim {
+struct _GtkDragAnim
+{
GtkDragSourceInfo *info;
gint step;
gint n_steps;
};
-struct _GtkDragFindData {
+struct _GtkDragFindData
+{
gint x;
gint y;
GdkDragContext *context;
@@ -131,7 +138,8 @@ struct _GtkDragFindData {
/* Enumeration for some targets we handle internally */
-enum {
+enum
+{
TARGET_MOTIF_SUCCESS = 0x40000000,
TARGET_MOTIF_FAILURE,
TARGET_DELETE
@@ -151,8 +159,8 @@ static void gtk_drag_get_event_actions (GdkEvent *event,
GdkDragAction actions,
GdkDragAction *suggested_action,
GdkDragAction *possible_actions);
-static GdkCursor * gtk_drag_get_cursor (GdkDragAction action);
-static GtkWidget *gtk_drag_get_ipc_widget (void);
+static GdkCursor* gtk_drag_get_cursor (GdkDragAction action);
+static GtkWidget* gtk_drag_get_ipc_widget (void);
static void gtk_drag_release_ipc_widget (GtkWidget *widget);
static void gtk_drag_highlight_paint (GtkWidget *widget);
@@ -226,70 +234,70 @@ static gint gtk_drag_abort_timeout (gpointer data);
#define action_ask_width 16
#define action_ask_height 16
-static const char action_ask_bits[] = {
+static const gchar action_ask_bits[] = {
0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x1f, 0x06, 0xc0, 0x76, 0xf8, 0xb6, 0xf7,
0xd6, 0xec, 0x66, 0xdb, 0x66, 0xdb, 0x96, 0xec, 0x76, 0xf7, 0x76, 0xfb,
0xf6, 0xfc, 0x72, 0xfb, 0x7a, 0xfb, 0xf8, 0xfc, };
#define action_ask_mask_width 16
#define action_ask_mask_height 16
-static const char action_ask_mask_bits[] = {
+static const gchar action_ask_mask_bits[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x8f, 0x07, 0xcf, 0x0f,
0xef, 0x1f, 0xff, 0x3c, 0xff, 0x3c, 0x6f, 0x1f, 0x8f, 0x0f, 0x8f, 0x07,
0x0f, 0x03, 0x8f, 0x07, 0x87, 0x07, 0x07, 0x03, };
#define action_copy_width 16
#define action_copy_height 16
-static const char action_copy_bits[] = {
+static const gchar action_copy_bits[] = {
0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x1f, 0x06, 0xc0, 0x76, 0xfb, 0x76, 0xfb,
0x76, 0xfb, 0x06, 0x83, 0xf6, 0xbf, 0xf6, 0xbf, 0x06, 0x83, 0x76, 0xfb,
0x76, 0xfb, 0x72, 0xfb, 0x7a, 0xf8, 0xf8, 0xff, };
#define action_copy_mask_width 16
#define action_copy_mask_height 16
-static const char action_copy_mask_bits[] = {
+static const gchar action_copy_mask_bits[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x8f, 0x07, 0x8f, 0x07,
0x8f, 0x07, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0x8f, 0x07,
0x8f, 0x07, 0x8f, 0x07, 0x87, 0x07, 0x07, 0x00, };
#define action_move_width 16
#define action_move_height 16
-static const char action_move_bits[] = {
+static const gchar action_move_bits[] = {
0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x1f, 0x06, 0xc0, 0x96, 0xff, 0x26, 0xff,
0xc6, 0xf8, 0xd6, 0xe3, 0x96, 0x8f, 0xb6, 0xbf, 0x36, 0xc3, 0x76, 0xfb,
0x76, 0xfa, 0xf2, 0xfa, 0xfa, 0xf8, 0xf8, 0xff, };
#define action_move_mask_width 16
#define action_move_mask_height 16
-static const char action_move_mask_bits[] = {
+static const gchar action_move_mask_bits[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x6f, 0x00, 0xff, 0x00,
0xff, 0x07, 0xef, 0x1f, 0xef, 0x7f, 0xcf, 0x7f, 0xcf, 0x3f, 0x8f, 0x07,
0x8f, 0x07, 0x0f, 0x07, 0x07, 0x07, 0x07, 0x00, };
#define action_link_width 16
#define action_link_height 16
-static const char action_link_bits[] = {
+static const gchar action_link_bits[] = {
0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x1f, 0x06, 0xc0, 0x36, 0xf8, 0xd6, 0xf7,
0x66, 0xec, 0xa6, 0xe8, 0x26, 0xdf, 0xe6, 0xbd, 0xd6, 0xa7, 0xb6, 0xa8,
0xb6, 0xb1, 0x72, 0xdf, 0xfa, 0xe0, 0xf8, 0xff, };
#define action_link_mask_width 16
#define action_link_mask_height 16
-static const char action_link_mask_bits[] = {
+static const gchar action_link_mask_bits[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xcf, 0x07, 0xef, 0x0f,
0xff, 0x1f, 0x7f, 0x1f, 0xff, 0x3f, 0xff, 0x7f, 0xef, 0x7f, 0xcf, 0x77,
0xcf, 0x7f, 0x8f, 0x3f, 0x07, 0x1f, 0x07, 0x00, };
#define action_none_width 16
#define action_none_height 16
-static const char action_none_bits[] = {
+static const gchar action_none_bits[] = {
0x00, 0x00, 0xfe, 0x7f, 0xfe, 0x1f, 0x06, 0xc0, 0xf6, 0xff, 0xf6, 0xff,
0xf6, 0xff, 0xf6, 0xff, 0xf6, 0xff, 0xf6, 0xff, 0xf6, 0xff, 0xf6, 0xff,
0xf6, 0xff, 0xf2, 0xff, 0xfa, 0xff, 0xf8, 0xff, };
#define action_none_mask_width 16
#define action_none_mask_height 16
-static const char action_none_mask_bits[] = {
+static const gchar action_none_mask_bits[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x0f, 0x00, 0x0f, 0x00,
0x0f, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x0f, 0x00, 0x0f, 0x00,
0x0f, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x07, 0x00, };
@@ -297,10 +305,11 @@ static const char action_none_mask_bits[] = {
#define CURSOR_WIDTH 16
#define CURSOR_HEIGHT 16
-static struct {
+static struct
+{
GdkDragAction action;
- const char *bits;
- const char *mask;
+ const gchar *bits;
+ const gchar *mask;
GdkCursor *cursor;
} drag_cursors[] = {
{ GDK_ACTION_DEFAULT, 0 },
@@ -311,46 +320,47 @@ static struct {
{ 0 , action_none_bits, action_none_mask_bits, NULL },
};
-static const gint n_drag_cursors = sizeof(drag_cursors) / sizeof(drag_cursors[0]);
+static const gint n_drag_cursors = sizeof (drag_cursors) / sizeof (drag_cursors[0]);
/* XPM */
-static const char * drag_default_xpm[] = {
-"32 32 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" .. ",
-" ..+. ",
-" ..++.. ",
-" ...++++. ",
-" ...++++++.. ",
-" ...+++++++++. ",
-" ...+++++++++++.. ",
-" ..+.++++++++++++.. ",
-" .++.++++++++++++.. ",
-" .+++.++++++++++++.. ",
-" .++++.++++++++++++. ",
-" .+++.+++++++++++++.. ",
-" .++.+++++++++++++++.. ",
-" .+.+++++++++++++++++.. ",
-" ..+++++++++++++++++++.. ",
-" ..++++++++++++++++++++. ",
-" .++++++++++++++++++++.. ",
-" ..+++++++++++++++++.. ",
-" .++++++++++++++++.. ",
-" ..+++++++++++++... ",
-" .++++++++++++.. ",
-" ..+++++++++.. ",
-" .++++++++.. ",
-" ..++++++.. ",
-" .+++++.. ",
-" .++.. ",
-" ... ",
-" .. ",
-" ",
-" "};
+static const gchar *drag_default_xpm[] = {
+ "32 32 3 1",
+ " c None",
+ ". c #000000",
+ "+ c #FFFFFF",
+ " ",
+ " ",
+ " .. ",
+ " ..+. ",
+ " ..++.. ",
+ " ...++++. ",
+ " ...++++++.. ",
+ " ...+++++++++. ",
+ " ...+++++++++++.. ",
+ " ..+.++++++++++++.. ",
+ " .++.++++++++++++.. ",
+ " .+++.++++++++++++.. ",
+ " .++++.++++++++++++. ",
+ " .+++.+++++++++++++.. ",
+ " .++.+++++++++++++++.. ",
+ " .+.+++++++++++++++++.. ",
+ " ..+++++++++++++++++++.. ",
+ " ..++++++++++++++++++++. ",
+ " .++++++++++++++++++++.. ",
+ " ..+++++++++++++++++.. ",
+ " .++++++++++++++++.. ",
+ " ..+++++++++++++... ",
+ " .++++++++++++.. ",
+ " ..+++++++++.. ",
+ " .++++++++.. ",
+ " ..++++++.. ",
+ " .+++++.. ",
+ " .++.. ",
+ " ... ",
+ " .. ",
+ " ",
+ " ",
+};
/*********************
* Utility functions *
@@ -365,34 +375,35 @@ static const char * drag_default_xpm[] = {
* results:
*************************************************************/
-static GtkWidget *
-gtk_drag_get_ipc_widget(void)
+static GtkWidget*
+gtk_drag_get_ipc_widget (void)
{
GtkWidget *result;
if (drag_widgets)
{
GSList *tmp = drag_widgets;
+
result = drag_widgets->data;
drag_widgets = drag_widgets->next;
g_slist_free_1 (tmp);
}
else
{
- result = gtk_invisible_new();
+ result = gtk_invisible_new ();
gtk_widget_show (result);
}
-
+
return result;
}
-/*************************************************************
+/****************************************************************
* gtk_drag_release_ipc_widget:
- * Releases widget retrieved with gtk_drag_get_ipc_widget()
+ * Releases widget retrieved with gtk_drag_get_ipc_widget ()
* arguments:
* widget: the widget to release.
* results:
- *************************************************************/
+ ****************************************************************/
static void
gtk_drag_release_ipc_widget (GtkWidget *widget)
@@ -409,7 +420,7 @@ gtk_drag_get_event_actions (GdkEvent *event,
{
*suggested_action = 0;
*possible_actions = 0;
-
+
if (event)
{
GdkModifierType state = 0;
@@ -429,15 +440,15 @@ gtk_drag_get_event_actions (GdkEvent *event,
case GDK_KEY_RELEASE:
state = event->key.state;
break;
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
+ case GDK_ENTER_NOTIFY:
+ case GDK_LEAVE_NOTIFY:
state = event->crossing.state;
break;
- default:
- break;
- }
+ default:
+ break;
+ }
- if (((button == 2) || (button == 3)) && (actions & GDK_ACTION_ASK))
+ if ((button == 2 || button == 3) && (actions & GDK_ACTION_ASK))
{
*suggested_action = GDK_ACTION_ASK;
*possible_actions = actions;
@@ -474,7 +485,7 @@ gtk_drag_get_event_actions (GdkEvent *event,
else
{
*possible_actions = actions;
-
+
if ((state & (GDK_MOD1_MASK)) && (actions & GDK_ACTION_ASK))
*suggested_action = GDK_ACTION_ASK;
else if (actions & GDK_ACTION_COPY)
@@ -489,7 +500,7 @@ gtk_drag_get_event_actions (GdkEvent *event,
return;
}
-static GdkCursor *
+static GdkCursor*
gtk_drag_get_cursor (GdkDragAction action)
{
gint i;
@@ -497,11 +508,11 @@ gtk_drag_get_cursor (GdkDragAction action)
for (i = 0 ; i < n_drag_cursors - 1; i++)
if (drag_cursors[i].action == action)
break;
-
+
if (drag_cursors[i].cursor == NULL)
{
GdkColor fg, bg;
-
+
GdkPixmap *pixmap =
gdk_bitmap_create_from_data (NULL,
drag_cursors[i].bits,
@@ -510,16 +521,16 @@ gtk_drag_get_cursor (GdkDragAction action)
gdk_bitmap_create_from_data (NULL,
drag_cursors[i].mask,
CURSOR_WIDTH, CURSOR_HEIGHT);
-
+
gdk_color_white (gdk_colormap_get_system(), &bg);
gdk_color_black (gdk_colormap_get_system(), &fg);
drag_cursors[i].cursor = gdk_cursor_new_from_pixmap (pixmap, mask, &fg, &bg, 0, 0);
-
+
gdk_pixmap_unref (pixmap);
gdk_pixmap_unref (mask);
}
-
+
return drag_cursors[i].cursor;
}
@@ -545,22 +556,22 @@ gtk_drag_get_data (GtkWidget *widget,
guint32 time)
{
GtkWidget *selection_widget;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (context != NULL);
-
- selection_widget = gtk_drag_get_ipc_widget();
-
+
+ selection_widget = gtk_drag_get_ipc_widget ();
+
gdk_drag_context_ref (context);
gtk_widget_ref (widget);
gtk_signal_connect (GTK_OBJECT (selection_widget), "selection_received",
GTK_SIGNAL_FUNC (gtk_drag_selection_received), widget);
-
+
gtk_object_set_data (GTK_OBJECT (selection_widget), "drag-context", context);
-
+
gtk_selection_convert (selection_widget,
- gdk_drag_get_selection(context),
+ gdk_drag_get_selection (context),
target,
time);
}
@@ -577,11 +588,11 @@ gtk_drag_get_data (GtkWidget *widget,
* a different application.
*************************************************************/
-GtkWidget *
+GtkWidget*
gtk_drag_get_source_widget (GdkDragContext *context)
{
GSList *tmp_list;
-
+
tmp_list = source_widgets;
while (tmp_list)
{
@@ -590,14 +601,15 @@ gtk_drag_get_source_widget (GdkDragContext *context)
if (ipc_widget->window == context->source_window)
{
GtkDragSourceInfo *info;
+
info = gtk_object_get_data (GTK_OBJECT (ipc_widget), "gtk-info");
-
+
return info ? info->widget : NULL;
}
-
+
tmp_list = tmp_list->next;
}
-
+
return NULL;
}
@@ -619,9 +631,9 @@ gtk_drag_finish (GdkDragContext *context,
guint32 time)
{
GdkAtom target = GDK_NONE;
-
+
g_return_if_fail (context != NULL);
-
+
if (success && del)
{
target = gdk_atom_intern ("DELETE", FALSE);
@@ -629,15 +641,15 @@ gtk_drag_finish (GdkDragContext *context,
else if (context->protocol == GDK_DRAG_PROTO_MOTIF)
{
target = gdk_atom_intern (success ?
- "XmTRANSFER_SUCCESS" :
- "XmTRANSFER_FAILURE",
+ "XmTRANSFER_SUCCESS" :
+ "XmTRANSFER_FAILURE",
FALSE);
}
-
+
if (target != GDK_NONE)
{
- GtkWidget *selection_widget = gtk_drag_get_ipc_widget();
-
+ GtkWidget *selection_widget = gtk_drag_get_ipc_widget ();
+
gdk_drag_context_ref (context);
gtk_object_set_data (GTK_OBJECT (selection_widget), "drag-context", context);
@@ -646,7 +658,7 @@ gtk_drag_finish (GdkDragContext *context,
NULL);
gtk_selection_convert (selection_widget,
- gdk_drag_get_selection(context),
+ gdk_drag_get_selection (context),
target,
time);
}
@@ -667,9 +679,9 @@ static void
gtk_drag_highlight_paint (GtkWidget *widget)
{
gint x, y, width, height;
-
+
g_return_if_fail (widget != NULL);
-
+
if (GTK_WIDGET_DRAWABLE (widget))
{
if (GTK_WIDGET_NO_WINDOW (widget))
@@ -733,7 +745,7 @@ gtk_drag_highlight (GtkWidget *widget)
gtk_signal_connect (GTK_OBJECT (widget), "expose_event",
GTK_SIGNAL_FUNC (gtk_drag_highlight_paint),
NULL);
-
+
gtk_widget_queue_draw (widget);
}
@@ -749,10 +761,10 @@ void
gtk_drag_unhighlight (GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
-
+
gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
GTK_SIGNAL_FUNC (gtk_drag_highlight_paint),
- NULL);
+ NULL);
gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
GTK_SIGNAL_FUNC (gtk_drag_highlight_expose),
NULL);
@@ -782,30 +794,30 @@ gtk_drag_dest_set (GtkWidget *widget,
GtkDragDestSite *site;
g_return_if_fail (widget != NULL);
-
+
/* HACK, do this in the destroy */
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
if (site)
gtk_signal_disconnect_by_data (GTK_OBJECT (widget), site);
-
+
if (GTK_WIDGET_REALIZED (widget))
gtk_drag_dest_realized (widget);
-
+
gtk_signal_connect (GTK_OBJECT (widget), "realize",
GTK_SIGNAL_FUNC (gtk_drag_dest_realized), NULL);
-
+
site = g_new (GtkDragDestSite, 1);
-
+
site->flags = flags;
site->have_drag = FALSE;
if (targets)
site->target_list = gtk_target_list_new (targets, n_targets);
else
site->target_list = NULL;
-
+
site->actions = actions;
site->do_proxy = FALSE;
-
+
gtk_object_set_data_full (GTK_OBJECT (widget), "gtk-drag-dest",
site, gtk_drag_dest_site_destroy);
}
@@ -832,20 +844,20 @@ gtk_drag_dest_set_proxy (GtkWidget *widget,
GtkDragDestSite *site;
g_return_if_fail (widget != NULL);
-
+
/* HACK, do this in the destroy */
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
if (site)
gtk_signal_disconnect_by_data (GTK_OBJECT (widget), site);
-
+
if (GTK_WIDGET_REALIZED (widget))
gtk_drag_dest_realized (widget);
-
+
gtk_signal_connect (GTK_OBJECT (widget), "realize",
GTK_SIGNAL_FUNC (gtk_drag_dest_realized), NULL);
-
+
site = g_new (GtkDragDestSite, 1);
-
+
site->flags = 0;
site->have_drag = FALSE;
site->target_list = NULL;
@@ -856,7 +868,7 @@ gtk_drag_dest_set_proxy (GtkWidget *widget,
site->do_proxy = TRUE;
site->proxy_protocol = protocol;
site->proxy_coords = use_coordinates;
-
+
gtk_object_set_data_full (GTK_OBJECT (widget), "gtk-drag-dest",
site, gtk_drag_dest_site_destroy);
}
@@ -873,7 +885,7 @@ void
gtk_drag_dest_unset (GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
-
+
gtk_object_set_data (GTK_OBJECT (widget), "gtk-drag-dest", NULL);
}
@@ -894,12 +906,12 @@ gtk_drag_dest_handle_event (GtkWidget *toplevel,
{
GtkDragDestInfo *info;
GdkDragContext *context;
-
+
g_return_if_fail (toplevel != NULL);
g_return_if_fail (event != NULL);
-
+
context = event->dnd.context;
-
+
info = g_dataset_get_data (context, "gtk-info");
if (!info)
{
@@ -915,7 +927,7 @@ gtk_drag_dest_handle_event (GtkWidget *toplevel,
info,
gtk_drag_dest_info_destroy);
}
-
+
/* Find the widget for the event */
switch (event->type)
{
@@ -932,53 +944,53 @@ gtk_drag_dest_handle_event (GtkWidget *toplevel,
case GDK_DRAG_MOTION:
case GDK_DROP_START:
- {
- GtkDragFindData data;
- gint tx, ty;
-
- if (event->type == GDK_DROP_START)
- info->dropped = TRUE;
-
- gdk_window_get_origin (toplevel->window, &tx, &ty);
-
- data.x = event->dnd.x_root - tx;
- data.y = event->dnd.y_root - ty;
- data.context = context;
- data.info = info;
- data.found = FALSE;
- data.toplevel = TRUE;
- data.callback = (event->type == GDK_DRAG_MOTION) ?
- gtk_drag_dest_motion : gtk_drag_dest_drop;
- data.time = event->dnd.time;
-
- gtk_drag_find_widget (toplevel, &data);
-
- /* We send a leave here so that the widget unhighlights
- * properly
- */
- if (info->widget &&
- ((event->type == GDK_DROP_START) || (!data.found)))
- {
- gtk_drag_dest_leave (info->widget, context, event->dnd.time);
- info->widget = NULL;
- }
-
- /* Send a reply.
- */
- if (event->type == GDK_DRAG_MOTION)
- {
- if (!data.found)
- gdk_drag_status (context, 0, event->dnd.time);
- }
- else if (event->type == GDK_DROP_START)
- {
- gdk_drop_reply (context, data.found, event->dnd.time);
- if ((context->protocol == GDK_DRAG_PROTO_MOTIF) && !data.found)
- gtk_drag_finish (context, FALSE, FALSE, event->dnd.time);
- }
- }
- break;
-
+ {
+ GtkDragFindData data;
+ gint tx, ty;
+
+ if (event->type == GDK_DROP_START)
+ info->dropped = TRUE;
+
+ gdk_window_get_origin (toplevel->window, &tx, &ty);
+
+ data.x = event->dnd.x_root - tx;
+ data.y = event->dnd.y_root - ty;
+ data.context = context;
+ data.info = info;
+ data.found = FALSE;
+ data.toplevel = TRUE;
+ data.callback = (event->type == GDK_DRAG_MOTION) ?
+ gtk_drag_dest_motion : gtk_drag_dest_drop;
+ data.time = event->dnd.time;
+
+ gtk_drag_find_widget (toplevel, &data);
+
+ /* We send a leave here so that the widget unhighlights
+ * properly
+ */
+ if (info->widget &&
+ ((event->type == GDK_DROP_START) || (!data.found)))
+ {
+ gtk_drag_dest_leave (info->widget, context, event->dnd.time);
+ info->widget = NULL;
+ }
+
+ /* Send a reply.
+ */
+ if (event->type == GDK_DRAG_MOTION)
+ {
+ if (!data.found)
+ gdk_drag_status (context, 0, event->dnd.time);
+ }
+ else if (event->type == GDK_DROP_START)
+ {
+ gdk_drop_reply (context, data.found, event->dnd.time);
+ if ((context->protocol == GDK_DRAG_PROTO_MOTIF) && !data.found)
+ gtk_drag_finish (context, FALSE, FALSE, event->dnd.time);
+ }
+ }
+ break;
+
default:
g_assert_not_reached();
}
@@ -1001,7 +1013,7 @@ gtk_drag_dest_find_target (GtkWidget *widget,
GList *tmp_target;
GList *tmp_source = NULL;
GtkWidget *source_widget = gtk_drag_get_source_widget (context);
-
+
tmp_target = site->target_list->list;
while (tmp_target)
{
@@ -1021,7 +1033,7 @@ gtk_drag_dest_find_target (GtkWidget *widget,
}
tmp_target = tmp_target->next;
}
-
+
return GDK_NONE;
}
@@ -1034,12 +1046,12 @@ gtk_drag_selection_received (GtkWidget *widget,
GdkDragContext *context;
GtkDragDestInfo *info;
GtkWidget *drop_widget;
-
+
drop_widget = data;
-
+
context = gtk_object_get_data (GTK_OBJECT (widget), "drag-context");
info = g_dataset_get_data (context, "gtk-info");
-
+
if (info->proxy_data &&
info->proxy_data->target == selection_data->target)
{
@@ -1051,7 +1063,7 @@ gtk_drag_selection_received (GtkWidget *widget,
gtk_main_quit();
return;
}
-
+
if (selection_data->target == gdk_atom_intern ("DELETE", FALSE))
{
gtk_drag_finish (context, TRUE, FALSE, time);
@@ -1064,13 +1076,13 @@ gtk_drag_selection_received (GtkWidget *widget,
else
{
GtkDragDestSite *site;
-
+
site = gtk_object_get_data (GTK_OBJECT (drop_widget), "gtk-drag-dest");
-
+
if (site->target_list)
{
guint target_info;
-
+
if (gtk_target_list_find (site->target_list,
selection_data->target,
&target_info))
@@ -1094,7 +1106,7 @@ gtk_drag_selection_received (GtkWidget *widget,
if (site->flags & GTK_DEST_DEFAULT_DROP)
{
-
+
gtk_drag_finish (context,
(selection_data->length >= 0),
(context->action == GDK_ACTION_MOVE),
@@ -1103,14 +1115,14 @@ gtk_drag_selection_received (GtkWidget *widget,
gtk_widget_unref (drop_widget);
}
-
+
gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
GTK_SIGNAL_FUNC (gtk_drag_selection_received),
data);
gtk_object_set_data (GTK_OBJECT (widget), "drag-context", NULL);
gdk_drag_context_unref (context);
-
+
gtk_drag_release_ipc_widget (widget);
}
@@ -1130,12 +1142,12 @@ gtk_drag_find_widget (GtkWidget *widget,
GtkAllocation new_allocation;
gint x_offset = 0;
gint y_offset = 0;
-
+
new_allocation = widget->allocation;
-
+
if (data->found || !GTK_WIDGET_MAPPED (widget))
return;
-
+
/* Note that in the following code, we only count the
* position as being inside a WINDOW widget if it is inside
* widget->window; points that are outside of widget->window
@@ -1155,7 +1167,7 @@ gtk_drag_find_widget (GtkWidget *widget,
{
gint tx, ty, twidth, theight;
gdk_window_get_size (window, &twidth, &theight);
-
+
if (new_allocation.x < 0)
{
new_allocation.width += new_allocation.x;
@@ -1170,7 +1182,7 @@ gtk_drag_find_widget (GtkWidget *widget,
new_allocation.width = twidth - new_allocation.x;
if (new_allocation.y + new_allocation.height > theight)
new_allocation.height = theight - new_allocation.y;
-
+
gdk_window_get_position (window, &tx, &ty);
new_allocation.x += tx;
x_offset += tx;
@@ -1180,7 +1192,7 @@ gtk_drag_find_widget (GtkWidget *widget,
window = gdk_window_get_parent (window);
}
}
-
+
if (data->toplevel ||
((data->x >= new_allocation.x) && (data->y >= new_allocation.y) &&
(data->x < new_allocation.x + new_allocation.width) &&
@@ -1204,7 +1216,7 @@ gtk_drag_find_widget (GtkWidget *widget,
data->found = new_data.found;
}
-
+
/* If not, and this widget is registered as a drop site, check to
* emit "drag_motion" to check if we are actually in
* a drop site.
@@ -1231,7 +1243,8 @@ gtk_drag_find_widget (GtkWidget *widget,
}
static void
-gtk_drag_proxy_begin (GtkWidget *widget, GtkDragDestInfo *dest_info)
+gtk_drag_proxy_begin (GtkWidget *widget,
+ GtkDragDestInfo *dest_info)
{
GtkDragSourceInfo *source_info;
GList *tmp_list;
@@ -1243,7 +1256,7 @@ gtk_drag_proxy_begin (GtkWidget *widget, GtkDragDestInfo *dest_info)
gtk_widget_ref (source_info->widget);
source_info->context = gdk_drag_begin (source_info->ipc_widget->window,
dest_info->context->targets);
-
+
source_info->target_list = gtk_target_list_new (NULL, 0);
tmp_list = dest_info->context->targets;
while (tmp_list)
@@ -1252,7 +1265,7 @@ gtk_drag_proxy_begin (GtkWidget *widget, GtkDragDestInfo *dest_info)
GPOINTER_TO_UINT (tmp_list->data), 0, 0);
tmp_list = tmp_list->next;
}
-
+
source_info->proxy_dest = dest_info;
g_dataset_set_data (source_info->context, "gtk-info", source_info);
@@ -1269,7 +1282,7 @@ static void
gtk_drag_dest_info_destroy (gpointer data)
{
GtkDragDestInfo *info = data;
-
+
g_free (info);
}
@@ -1284,10 +1297,10 @@ static void
gtk_drag_dest_site_destroy (gpointer data)
{
GtkDragDestSite *site = data;
-
+
if (site->target_list)
gtk_target_list_unref (site->target_list);
-
+
g_free (site);
}
@@ -1300,14 +1313,14 @@ gtk_drag_dest_leave (GtkWidget *widget,
guint time)
{
GtkDragDestSite *site;
-
+
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
g_return_if_fail (site != NULL);
-
+
if (site->do_proxy)
{
GtkDragDestInfo *info = g_dataset_get_data (context, "gtk-info");
-
+
if (info->proxy_source && !info->dropped)
gdk_drag_abort (info->proxy_source->context, time);
@@ -1317,7 +1330,7 @@ gtk_drag_dest_leave (GtkWidget *widget,
{
if (site->flags & GTK_DEST_DEFAULT_HIGHLIGHT)
gtk_drag_unhighlight (widget);
-
+
if (!(site->flags & GTK_DEST_DEFAULT_MOTION) || site->have_drag)
gtk_signal_emit_by_name (GTK_OBJECT (widget), "drag_leave",
context, time);
@@ -1336,24 +1349,24 @@ gtk_drag_dest_motion (GtkWidget *widget,
GtkDragDestSite *site;
GdkDragAction action = 0;
gboolean retval;
-
+
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
g_return_val_if_fail (site != NULL, FALSE);
-
+
if (site->do_proxy)
{
GdkAtom selection;
GdkEvent *current_event;
GdkWindow *dest_window;
GdkDragProtocol proto;
-
+
GtkDragDestInfo *info = g_dataset_get_data (context, "gtk-info");
-
+
if (!info->proxy_source)
gtk_drag_proxy_begin (widget, info);
-
+
current_event = gtk_get_current_event ();
-
+
if (site->proxy_window)
{
dest_window = site->proxy_window;
@@ -1374,17 +1387,17 @@ gtk_drag_dest_motion (GtkWidget *widget,
current_event->dnd.y_root,
context->suggested_action,
context->actions, time);
-
+
selection = gdk_drag_get_selection (info->proxy_source->context);
if (selection &&
selection != gdk_drag_get_selection (info->context))
gtk_drag_source_check_selection (info->proxy_source, selection, time);
-
+
gdk_event_free (current_event);
return TRUE;
}
-
+
if (site->flags & GTK_DEST_DEFAULT_MOTION)
{
if (context->suggested_action & site->actions)
@@ -1421,10 +1434,10 @@ gtk_drag_dest_motion (GtkWidget *widget,
return TRUE;
}
}
-
+
gtk_signal_emit_by_name (GTK_OBJECT (widget), "drag_motion",
context, x, y, time, &retval);
-
+
return (site->flags & GTK_DEST_DEFAULT_MOTION) ? TRUE : retval;
}
@@ -1437,16 +1450,16 @@ gtk_drag_dest_drop (GtkWidget *widget,
{
GtkDragDestSite *site;
GtkDragDestInfo *info;
-
+
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
g_return_val_if_fail (site != NULL, FALSE);
-
+
info = g_dataset_get_data (context, "gtk-info");
g_return_val_if_fail (info != NULL, FALSE);
-
+
info->drop_x = x;
info->drop_y = y;
-
+
if (site->do_proxy)
{
if (info->proxy_source ||
@@ -1470,7 +1483,7 @@ gtk_drag_dest_drop (GtkWidget *widget,
info->proxy_drop_time = time;
current_event = gtk_get_current_event ();
-
+
if (site->proxy_window)
{
dest_window = site->proxy_window;
@@ -1484,42 +1497,42 @@ gtk_drag_dest_drop (GtkWidget *widget,
current_event->dnd.y_root,
&dest_window, &proto);
}
-
+
gdk_drag_motion (info->proxy_source->context,
dest_window, proto,
current_event->dnd.x_root,
current_event->dnd.y_root,
context->suggested_action,
context->actions, time);
-
+
selection = gdk_drag_get_selection (info->proxy_source->context);
if (selection &&
selection != gdk_drag_get_selection (info->context))
gtk_drag_source_check_selection (info->proxy_source, selection, time);
-
+
gdk_event_free (current_event);
-
+
}
-
+
return TRUE;
}
else
{
gboolean retval;
-
+
if (site->flags & GTK_DEST_DEFAULT_DROP)
{
GdkAtom target = gtk_drag_dest_find_target (widget, site, context);
-
+
if (target == GDK_NONE)
return FALSE;
gtk_drag_get_data (widget, context, target, time);
}
-
+
gtk_signal_emit_by_name (GTK_OBJECT (widget), "drag_drop",
context, x, y, time, &retval);
-
+
return (site->flags & GTK_DEST_DEFAULT_DROP) ? TRUE : retval;
}
}
@@ -1540,7 +1553,7 @@ gtk_drag_dest_drop (GtkWidget *widget,
* results:
*************************************************************/
-GdkDragContext *
+GdkDragContext*
gtk_drag_begin (GtkWidget *widget,
GtkTargetList *target_list,
GdkDragAction actions,
@@ -1552,20 +1565,20 @@ gtk_drag_begin (GtkWidget *widget,
GList *tmp_list;
guint32 time = GDK_CURRENT_TIME;
GdkDragAction possible_actions, suggested_action;
-
+
g_return_val_if_fail (widget != NULL, NULL);
g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), NULL);
g_return_val_if_fail (target_list != NULL, NULL);
-
+
if (event)
time = gdk_event_get_time (event);
-
+
info = g_new0 (GtkDragSourceInfo, 1);
info->ipc_widget = gtk_drag_get_ipc_widget ();
source_widgets = g_slist_prepend (source_widgets, info->ipc_widget);
-
+
gtk_object_set_data (GTK_OBJECT (info->ipc_widget), "gtk-info", info);
-
+
tmp_list = g_list_last (target_list->list);
while (tmp_list)
{
@@ -1574,7 +1587,7 @@ gtk_drag_begin (GtkWidget *widget,
GINT_TO_POINTER (pair->target));
tmp_list = tmp_list->prev;
}
-
+
info->widget = widget;
gtk_widget_ref (info->widget);
@@ -1582,25 +1595,25 @@ gtk_drag_begin (GtkWidget *widget,
g_list_free (targets);
g_dataset_set_data (info->context, "gtk-info", info);
-
+
info->button = button;
info->target_list = target_list;
gtk_target_list_ref (target_list);
-
+
info->possible_actions = actions;
-
+
info->cursor = NULL;
info->status = GTK_DRAG_STATUS_DRAG;
info->last_event = NULL;
info->selections = NULL;
info->icon_window = NULL;
-
+
gtk_drag_get_event_actions (event, info->button, actions,
&suggested_action, &possible_actions);
if (event)
info->cursor = gtk_drag_get_cursor (suggested_action);
-
+
/* Set cur_x, cur_y here so if the "drag_begin" signal shows
* the drag icon, it will be in the right place
*/
@@ -1613,37 +1626,37 @@ gtk_drag_begin (GtkWidget *widget,
{
gint x, y;
gdk_window_get_pointer (GDK_ROOT_PARENT(), &x, &y, NULL);
-
+
info->cur_x = x;
info->cur_y = y;
}
-
+
gtk_signal_emit_by_name (GTK_OBJECT (widget), "drag_begin",
info->context);
/* We use a GTK grab here to override any grabs that the widget
* we are dragging from might have held
*/
-
+
gtk_grab_add (info->ipc_widget);
gdk_pointer_grab (info->ipc_widget->window, FALSE,
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_RELEASE_MASK, NULL,
info->cursor, time);
-
+
if (event->type == GDK_MOTION_NOTIFY)
gtk_drag_motion_cb (info->ipc_widget, (GdkEventMotion *)event, info);
-
+
info->start_x = info->cur_x;
info->start_y = info->cur_y;
-
+
gtk_signal_connect (GTK_OBJECT (info->ipc_widget), "button_release_event",
GTK_SIGNAL_FUNC (gtk_drag_button_release_cb), info);
gtk_signal_connect (GTK_OBJECT (info->ipc_widget), "motion_notify_event",
GTK_SIGNAL_FUNC (gtk_drag_motion_cb), info);
gtk_signal_connect (GTK_OBJECT (info->ipc_widget), "selection_get",
GTK_SIGNAL_FUNC (gtk_drag_selection_get), info);
-
+
return info->context;
}
@@ -1660,23 +1673,23 @@ gtk_drag_begin (GtkWidget *widget,
*************************************************************/
void
-gtk_drag_source_set (GtkWidget *widget,
- GdkModifierType start_button_mask,
- const GtkTargetEntry *targets,
- gint n_targets,
- GdkDragAction actions)
+gtk_drag_source_set (GtkWidget *widget,
+ GdkModifierType start_button_mask,
+ const GtkTargetEntry *targets,
+ gint n_targets,
+ GdkDragAction actions)
{
GtkDragSourceSite *site;
-
+
g_return_if_fail (widget != NULL);
-
+
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data");
-
+
gtk_widget_add_events (widget,
gtk_widget_get_events (widget) |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_BUTTON_MOTION_MASK);
-
+
if (site)
{
if (site->target_list)
@@ -1697,16 +1710,16 @@ gtk_drag_source_set (GtkWidget *widget,
"gtk-site-data",
site, gtk_drag_source_site_destroy);
}
-
+
site->start_button_mask = start_button_mask;
-
+
if (targets)
site->target_list = gtk_target_list_new (targets, n_targets);
else
site->target_list = NULL;
-
+
site->actions = actions;
-
+
}
/*************************************************************
@@ -1721,11 +1734,11 @@ void
gtk_drag_source_unset (GtkWidget *widget)
{
GtkDragSourceSite *site;
-
+
g_return_if_fail (widget != NULL);
-
+
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data");
-
+
if (site)
{
gtk_signal_disconnect_by_data (GTK_OBJECT (widget), site);
@@ -1744,15 +1757,15 @@ gtk_drag_source_unset (GtkWidget *widget)
*************************************************************/
void
-gtk_drag_source_set_icon (GtkWidget *widget,
- GdkColormap *colormap,
- GdkPixmap *pixmap,
- GdkBitmap *mask)
+gtk_drag_source_set_icon (GtkWidget *widget,
+ GdkColormap *colormap,
+ GdkPixmap *pixmap,
+ GdkBitmap *mask)
{
GtkDragSourceSite *site;
-
+
g_return_if_fail (widget != NULL);
-
+
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-site-data");
g_return_if_fail (site != NULL);
@@ -1762,15 +1775,15 @@ gtk_drag_source_set_icon (GtkWidget *widget,
gdk_pixmap_unref (site->pixmap);
if (site->mask)
gdk_pixmap_unref (site->mask);
-
+
site->colormap = colormap;
if (colormap)
gdk_colormap_ref (colormap);
-
+
site->pixmap = pixmap;
if (pixmap)
gdk_pixmap_ref (pixmap);
-
+
site->mask = mask;
if (mask)
gdk_pixmap_ref (mask);
@@ -1788,23 +1801,23 @@ gtk_drag_source_set_icon (GtkWidget *widget,
*************************************************************/
void
-gtk_drag_set_icon_widget (GdkDragContext *context,
- GtkWidget *widget,
- gint hot_x,
- gint hot_y)
+gtk_drag_set_icon_widget (GdkDragContext *context,
+ GtkWidget *widget,
+ gint hot_x,
+ gint hot_y)
{
GtkDragSourceInfo *info;
-
+
g_return_if_fail (context != NULL);
g_return_if_fail (widget != NULL);
-
+
info = g_dataset_get_data (context, "gtk-info");
gtk_drag_remove_icon (info);
info->icon_window = widget;
info->hot_x = hot_x;
info->hot_y = hot_y;
-
+
if (widget)
{
gtk_widget_set_uposition (widget,
@@ -1830,40 +1843,40 @@ gtk_drag_set_icon_widget (GdkDragContext *context,
*************************************************************/
void
-gtk_drag_set_icon_pixmap (GdkDragContext *context,
- GdkColormap *colormap,
- GdkPixmap *pixmap,
- GdkBitmap *mask,
- gint hot_x,
- gint hot_y)
+gtk_drag_set_icon_pixmap (GdkDragContext *context,
+ GdkColormap *colormap,
+ GdkPixmap *pixmap,
+ GdkBitmap *mask,
+ gint hot_x,
+ gint hot_y)
{
GtkWidget *window;
gint width, height;
-
+
g_return_if_fail (context != NULL);
g_return_if_fail (colormap != NULL);
g_return_if_fail (pixmap != NULL);
-
+
gdk_window_get_size (pixmap, &width, &height);
-
- gtk_widget_push_visual (gdk_colormap_get_visual(colormap));
+
+ gtk_widget_push_visual (gdk_colormap_get_visual (colormap));
gtk_widget_push_colormap (colormap);
-
+
window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_set_events (window, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
-
+
gtk_widget_pop_visual ();
gtk_widget_pop_colormap ();
-
+
gtk_widget_set_usize (window, width, height);
gtk_widget_realize (window);
-
+
gdk_window_set_back_pixmap (window->window, pixmap, FALSE);
if (mask)
gtk_widget_shape_combine_mask (window, mask, 0, 0);
-
+
gtk_drag_set_icon_widget (context, window, hot_x, hot_y);
}
@@ -1879,7 +1892,7 @@ void
gtk_drag_set_icon_default (GdkDragContext *context)
{
g_return_if_fail (context != NULL);
-
+
if (!default_icon_pixmap)
{
default_icon_colormap = gdk_colormap_get_system ();
@@ -1891,7 +1904,7 @@ gtk_drag_set_icon_default (GdkDragContext *context)
default_icon_hot_x = -2;
default_icon_hot_y = -2;
}
-
+
gtk_drag_set_icon_pixmap (context,
default_icon_colormap,
default_icon_pixmap,
@@ -1928,13 +1941,13 @@ gtk_drag_set_default_icon (GdkColormap *colormap,
gdk_pixmap_unref (default_icon_pixmap);
if (default_icon_mask)
gdk_pixmap_unref (default_icon_pixmap);
-
+
default_icon_colormap = colormap;
gdk_colormap_ref (colormap);
default_icon_pixmap = pixmap;
gdk_pixmap_ref (pixmap);
-
+
default_icon_mask = mask;
if (mask)
gdk_pixmap_ref (mask);
@@ -1961,61 +1974,61 @@ gtk_drag_source_handle_event (GtkWidget *widget,
{
GtkDragSourceInfo *info;
GdkDragContext *context;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (event != NULL);
-
+
context = event->dnd.context;
info = g_dataset_get_data (context, "gtk-info");
if (!info)
return;
-
+
switch (event->type)
{
case GDK_DRAG_STATUS:
- {
- GdkCursor *cursor;
-
- if (info->proxy_dest)
- {
- if (!event->dnd.send_event)
- {
- if (info->proxy_dest->proxy_drop_wait)
- {
- /* Aha - we can finally pass the MOTIF DROP on... */
- gdk_drag_drop (info->context, info->proxy_dest->proxy_drop_time);
- }
- else
- {
- gdk_drag_status (info->proxy_dest->context,
- event->dnd.context->action,
- event->dnd.time);
- }
- }
- }
- else
- {
- cursor = gtk_drag_get_cursor (event->dnd.context->action);
- if (info->cursor != cursor)
- {
- XChangeActivePointerGrab (GDK_WINDOW_XDISPLAY (widget->window),
- PointerMotionMask | PointerMotionHintMask | ButtonReleaseMask,
- ((GdkCursorPrivate *)cursor)->xcursor,
- event->dnd.time);
- info->cursor = cursor;
- }
-
- if (info->last_event)
- {
- gtk_drag_motion_cb (info->widget,
- (GdkEventMotion *)info->last_event,
- info);
- info->last_event = NULL;
- }
- }
- }
- break;
+ {
+ GdkCursor *cursor;
+ if (info->proxy_dest)
+ {
+ if (!event->dnd.send_event)
+ {
+ if (info->proxy_dest->proxy_drop_wait)
+ {
+ /* Aha - we can finally pass the MOTIF DROP on... */
+ gdk_drag_drop (info->context, info->proxy_dest->proxy_drop_time);
+ }
+ else
+ {
+ gdk_drag_status (info->proxy_dest->context,
+ event->dnd.context->action,
+ event->dnd.time);
+ }
+ }
+ }
+ else
+ {
+ cursor = gtk_drag_get_cursor (event->dnd.context->action);
+ if (info->cursor != cursor)
+ {
+ XChangeActivePointerGrab (GDK_WINDOW_XDISPLAY (widget->window),
+ PointerMotionMask | PointerMotionHintMask | ButtonReleaseMask,
+ ((GdkCursorPrivate *)cursor)->xcursor,
+ event->dnd.time);
+ info->cursor = cursor;
+ }
+
+ if (info->last_event)
+ {
+ gtk_drag_motion_cb (info->widget,
+ (GdkEventMotion *)info->last_event,
+ info);
+ info->last_event = NULL;
+ }
+ }
+ }
+ break;
+
case GDK_DROP_FINISHED:
gtk_drag_drop_finished (info, TRUE, event->dnd.time);
break;
@@ -2039,7 +2052,7 @@ gtk_drag_source_check_selection (GtkDragSourceInfo *info,
guint32 time)
{
GList *tmp_list;
-
+
tmp_list = info->selections;
while (tmp_list)
{
@@ -2047,16 +2060,16 @@ gtk_drag_source_check_selection (GtkDragSourceInfo *info,
return;
tmp_list = tmp_list->next;
}
-
+
gtk_selection_owner_set (info->ipc_widget, selection, time);
info->selections = g_list_prepend (info->selections,
GUINT_TO_POINTER (selection));
-
+
tmp_list = info->target_list->list;
while (tmp_list)
{
GtkTargetPair *pair = tmp_list->data;
-
+
gtk_selection_add_target (info->ipc_widget,
selection,
pair->target,
@@ -2075,7 +2088,7 @@ gtk_drag_source_check_selection (GtkDragSourceInfo *info,
gdk_atom_intern ("XmTRANSFER_FAILURE", FALSE),
TARGET_MOTIF_FAILURE);
}
-
+
gtk_selection_add_target (info->ipc_widget,
selection,
gdk_atom_intern ("DELETE", FALSE),
@@ -2098,7 +2111,7 @@ gtk_drag_drop_finished (GtkDragSourceInfo *info,
guint time)
{
gtk_drag_source_release_selections (info, time);
-
+
if (info->proxy_dest)
{
/* The time from the event isn't reliable for Xdnd drags */
@@ -2123,7 +2136,7 @@ gtk_drag_drop_finished (GtkDragSourceInfo *info,
anim->n_steps = CLAMP (anim->n_steps, ANIM_MIN_STEPS, ANIM_MAX_STEPS);
if (info->icon_window)
{
- gtk_widget_show(info->icon_window);
+ gtk_widget_show (info->icon_window);
gdk_window_raise (info->icon_window->window);
}
@@ -2144,11 +2157,12 @@ gtk_drag_source_release_selections (GtkDragSourceInfo *info,
while (tmp_list)
{
GdkAtom selection = GPOINTER_TO_UINT (tmp_list->data);
+
if (gdk_selection_owner_get (selection) == info->ipc_widget->window)
gtk_selection_owner_set (NULL, selection, time);
tmp_list = tmp_list->next;
}
-
+
g_list_free (info->selections);
info->selections = NULL;
}
@@ -2162,7 +2176,8 @@ gtk_drag_source_release_selections (GtkDragSourceInfo *info,
*************************************************************/
static void
-gtk_drag_drop (GtkDragSourceInfo *info, guint32 time)
+gtk_drag_drop (GtkDragSourceInfo *info,
+ guint32 time)
{
if (info->context->protocol == GDK_DRAG_PROTO_ROOTWIN)
{
@@ -2199,7 +2214,7 @@ gtk_drag_drop (GtkDragSourceInfo *info, guint32 time)
{
if (info->icon_window)
gtk_widget_hide (info->icon_window);
-
+
gdk_drag_drop (info->context, time);
info->drop_timeout = gtk_timeout_add (DROP_ABORT_TIME,
gtk_drag_abort_timeout,
@@ -2218,7 +2233,7 @@ gtk_drag_source_event_cb (GtkWidget *widget,
{
GtkDragSourceSite *site;
site = (GtkDragSourceSite *)data;
-
+
switch (event->type)
{
case GDK_BUTTON_PRESS:
@@ -2261,10 +2276,10 @@ gtk_drag_source_event_cb (GtkWidget *widget,
context = gtk_drag_begin (widget, site->target_list,
site->actions,
i, event);
-
+
info = g_dataset_get_data (context, "gtk-info");
-
+
if (!info->icon_window)
{
if (site->pixmap)
@@ -2275,7 +2290,7 @@ gtk_drag_source_event_cb (GtkWidget *widget,
else
gtk_drag_set_icon_default (context);
}
-
+
return TRUE;
}
}
@@ -2291,10 +2306,10 @@ static void
gtk_drag_source_site_destroy (gpointer data)
{
GtkDragSourceSite *site = data;
-
+
if (site->target_list)
gtk_target_list_unref (site->target_list);
-
+
if (site->pixmap)
gdk_pixmap_unref (site->pixmap);
@@ -2314,10 +2329,10 @@ gtk_drag_selection_get (GtkWidget *widget,
GtkDragSourceInfo *info = data;
static GdkAtom null_atom = GDK_NONE;
guint target_info;
-
+
if (!null_atom)
null_atom = gdk_atom_intern ("NULL", FALSE);
-
+
switch (sel_info)
{
case TARGET_DELETE:
@@ -2371,14 +2386,14 @@ gtk_drag_anim_timeout (gpointer data)
GtkDragAnim *anim = data;
gint x, y;
gboolean retval;
-
+
GDK_THREADS_ENTER ();
-
+
if (anim->step == anim->n_steps)
{
gtk_drag_source_info_destroy (anim->info);
g_free (anim);
-
+
retval = FALSE;
}
else
@@ -2391,14 +2406,14 @@ gtk_drag_anim_timeout (gpointer data)
gtk_widget_set_uposition (anim->info->icon_window,
x - anim->info->hot_x,
y - anim->info->hot_y);
-
+
anim->step++;
-
+
retval = TRUE;
}
-
+
GDK_THREADS_LEAVE ();
-
+
return retval;
}
@@ -2409,7 +2424,7 @@ gtk_drag_remove_icon (GtkDragSourceInfo *info)
{
gtk_widget_hide (info->icon_window);
gtk_widget_unref (info->icon_window);
-
+
info->icon_window = NULL;
}
}
@@ -2418,30 +2433,30 @@ static void
gtk_drag_source_info_destroy (gpointer data)
{
GtkDragSourceInfo *info = data;
-
+
gtk_drag_remove_icon (data);
-
+
if (!info->proxy_dest)
gtk_signal_emit_by_name (GTK_OBJECT (info->widget), "drag_end",
info->context);
-
+
if (info->widget)
gtk_widget_unref (info->widget);
-
+
gtk_signal_disconnect_by_data (GTK_OBJECT (info->ipc_widget), info);
gtk_selection_remove_all (info->ipc_widget);
gtk_object_set_data (GTK_OBJECT (info->ipc_widget), "gtk-info", NULL);
source_widgets = g_slist_remove (source_widgets, info->ipc_widget);
gtk_drag_release_ipc_widget (info->ipc_widget);
-
+
gtk_target_list_unref (info->target_list);
-
+
g_dataset_set_data (info->context, "gtk-info", NULL);
gdk_drag_context_unref (info->context);
-
+
if (info->drop_timeout)
gtk_timeout_remove (info->drop_timeout);
-
+
g_free (info);
}
@@ -2466,14 +2481,14 @@ gtk_drag_motion_cb (GtkWidget *widget,
GdkWindow *dest_window;
GdkDragProtocol protocol;
gint x_root, y_root;
-
+
if (event->is_hint)
{
gdk_window_get_pointer (GDK_ROOT_PARENT(), &x_root, &y_root, NULL);
event->x_root = x_root;
event->y_root = y_root;
}
-
+
gtk_drag_get_event_actions ((GdkEvent *)event,
info->button,
info->possible_actions,
@@ -2481,7 +2496,7 @@ gtk_drag_motion_cb (GtkWidget *widget,
info->cur_x = event->x_root;
info->cur_y = event->y_root;
-
+
if (info->icon_window)
{
gdk_window_raise (info->icon_window->window);
@@ -2494,7 +2509,7 @@ gtk_drag_motion_cb (GtkWidget *widget,
gdk_drag_find_window (info->context,
window, event->x_root, event->y_root,
&dest_window, &protocol);
-
+
if (gdk_drag_motion (info->context, dest_window, protocol,
event->x_root, event->y_root, action,
possible_actions,
@@ -2505,21 +2520,21 @@ gtk_drag_motion_cb (GtkWidget *widget,
info->last_event = gdk_event_copy ((GdkEvent *)event);
}
-
+
if (dest_window)
gdk_window_unref (dest_window);
-
+
selection = gdk_drag_get_selection (info->context);
if (selection)
gtk_drag_source_check_selection (info, selection, event->time);
-
+
#if 0
/* We ignore the response, so we can respond precisely to the drop
*/
if (event->is_hint)
gdk_window_get_pointer (widget->window, NULL, NULL, NULL);
#endif
-
+
return TRUE;
}
@@ -2539,14 +2554,14 @@ gtk_drag_button_release_cb (GtkWidget *widget,
GtkDragSourceInfo *info = (GtkDragSourceInfo *)data;
GtkWidget *source_widget = info->widget;
GdkEvent send_event;
-
+
gtk_widget_ref (source_widget);
-
+
if (event->button != info->button)
return FALSE;
-
+
gdk_pointer_ungrab (event->time);
-
+
gtk_grab_remove (widget);
gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
GTK_SIGNAL_FUNC (gtk_drag_button_release_cb),
@@ -2554,7 +2569,7 @@ gtk_drag_button_release_cb (GtkWidget *widget,
gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
GTK_SIGNAL_FUNC (gtk_drag_motion_cb),
info);
-
+
if ((info->context->action != 0) && (info->context->dest_window != NULL))
{
gtk_drag_drop (info, event->time);
@@ -2564,14 +2579,14 @@ gtk_drag_button_release_cb (GtkWidget *widget,
gdk_drag_abort (info->context, event->time);
gtk_drag_drop_finished (info, FALSE, event->time);
}
-
+
/* Send on a release pair to the the original
* widget to convince it to release its grab. We need to
* call gtk_propagate_event() here, instead of
* gtk_widget_event() because widget like GtkList may
* expect propagation.
*/
-
+
send_event.button.type = GDK_BUTTON_RELEASE;
send_event.button.window = GDK_ROOT_PARENT ();
send_event.button.send_event = TRUE;
@@ -2587,9 +2602,9 @@ gtk_drag_button_release_cb (GtkWidget *widget,
send_event.button.deviceid = GDK_CORE_POINTER;
send_event.button.x_root = 0;
send_event.button.y_root = 0;
-
+
gtk_propagate_event (source_widget, &send_event);
-
+
gtk_widget_unref (source_widget);
return TRUE;
@@ -2600,10 +2615,10 @@ gtk_drag_abort_timeout (gpointer data)
{
GtkDragSourceInfo *info = data;
guint32 time = GDK_CURRENT_TIME;
-
+
if (info->proxy_dest)
time = info->proxy_dest->proxy_drop_time;
-
+
info->drop_timeout = 0;
gtk_drag_drop_finished (info, FALSE, time);