Commit 796dc4b1 authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

new function for mapping a window without fooling with stacking order, but

2001-06-19  Havoc Pennington  <hp@pobox.com>

	* gdk/x11/gdkwindow-x11.c (gdk_window_show_unraised): new function
	for mapping a window without fooling with stacking order, but
	updating the "withdrawn" flag

	* gdk/x11/gdkevents-x11.c (gdk_event_translate): Do event
	filtering as soon as possible, moving move resize and wmspec_check
	handling after the event filter.  Make default filter apply to all
	events, not just those with no GdkWindow wrapped around the X
	window. Fix a FIXME about how the window could be a pixmap using
	RTTI; this of course assumes GDK_IS_WINDOW() is optimized.

	Also, be robust against events not on a known GdkWindow.

	* gdk/x11/gdkmain-x11.c (gdk_x11_grab_server,
	gdk_x11_ungrab_server): export reference-counted server grabs, so
	other people can grab server over a GDK function that also does
	so.
parent 8eaa0716
2001-06-19 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_show_unraised): new function
for mapping a window without fooling with stacking order, but
updating the "withdrawn" flag
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Do event
filtering as soon as possible, moving move resize and wmspec_check
handling after the event filter. Make default filter apply to all
events, not just those with no GdkWindow wrapped around the X
window. Fix a FIXME about how the window could be a pixmap using
RTTI; this of course assumes GDK_IS_WINDOW() is optimized.
Also, be robust against events not on a known GdkWindow.
* gdk/x11/gdkmain-x11.c (gdk_x11_grab_server,
gdk_x11_ungrab_server): export reference-counted server grabs, so
other people can grab server over a GDK function that also does
so.
Wed Jun 27 19:40:31 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c
......
2001-06-19 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_show_unraised): new function
for mapping a window without fooling with stacking order, but
updating the "withdrawn" flag
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Do event
filtering as soon as possible, moving move resize and wmspec_check
handling after the event filter. Make default filter apply to all
events, not just those with no GdkWindow wrapped around the X
window. Fix a FIXME about how the window could be a pixmap using
RTTI; this of course assumes GDK_IS_WINDOW() is optimized.
Also, be robust against events not on a known GdkWindow.
* gdk/x11/gdkmain-x11.c (gdk_x11_grab_server,
gdk_x11_ungrab_server): export reference-counted server grabs, so
other people can grab server over a GDK function that also does
so.
Wed Jun 27 19:40:31 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c
......
2001-06-19 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_show_unraised): new function
for mapping a window without fooling with stacking order, but
updating the "withdrawn" flag
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Do event
filtering as soon as possible, moving move resize and wmspec_check
handling after the event filter. Make default filter apply to all
events, not just those with no GdkWindow wrapped around the X
window. Fix a FIXME about how the window could be a pixmap using
RTTI; this of course assumes GDK_IS_WINDOW() is optimized.
Also, be robust against events not on a known GdkWindow.
* gdk/x11/gdkmain-x11.c (gdk_x11_grab_server,
gdk_x11_ungrab_server): export reference-counted server grabs, so
other people can grab server over a GDK function that also does
so.
Wed Jun 27 19:40:31 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c
......
2001-06-19 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_show_unraised): new function
for mapping a window without fooling with stacking order, but
updating the "withdrawn" flag
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Do event
filtering as soon as possible, moving move resize and wmspec_check
handling after the event filter. Make default filter apply to all
events, not just those with no GdkWindow wrapped around the X
window. Fix a FIXME about how the window could be a pixmap using
RTTI; this of course assumes GDK_IS_WINDOW() is optimized.
Also, be robust against events not on a known GdkWindow.
* gdk/x11/gdkmain-x11.c (gdk_x11_grab_server,
gdk_x11_ungrab_server): export reference-counted server grabs, so
other people can grab server over a GDK function that also does
so.
Wed Jun 27 19:40:31 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c
......
2001-06-19 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_show_unraised): new function
for mapping a window without fooling with stacking order, but
updating the "withdrawn" flag
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Do event
filtering as soon as possible, moving move resize and wmspec_check
handling after the event filter. Make default filter apply to all
events, not just those with no GdkWindow wrapped around the X
window. Fix a FIXME about how the window could be a pixmap using
RTTI; this of course assumes GDK_IS_WINDOW() is optimized.
Also, be robust against events not on a known GdkWindow.
* gdk/x11/gdkmain-x11.c (gdk_x11_grab_server,
gdk_x11_ungrab_server): export reference-counted server grabs, so
other people can grab server over a GDK function that also does
so.
Wed Jun 27 19:40:31 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c
......
2001-06-19 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_show_unraised): new function
for mapping a window without fooling with stacking order, but
updating the "withdrawn" flag
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Do event
filtering as soon as possible, moving move resize and wmspec_check
handling after the event filter. Make default filter apply to all
events, not just those with no GdkWindow wrapped around the X
window. Fix a FIXME about how the window could be a pixmap using
RTTI; this of course assumes GDK_IS_WINDOW() is optimized.
Also, be robust against events not on a known GdkWindow.
* gdk/x11/gdkmain-x11.c (gdk_x11_grab_server,
gdk_x11_ungrab_server): export reference-counted server grabs, so
other people can grab server over a GDK function that also does
so.
Wed Jun 27 19:40:31 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c
......
2001-06-19 Havoc Pennington <hp@pobox.com>
* gdk/x11/gdkwindow-x11.c (gdk_window_show_unraised): new function
for mapping a window without fooling with stacking order, but
updating the "withdrawn" flag
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Do event
filtering as soon as possible, moving move resize and wmspec_check
handling after the event filter. Make default filter apply to all
events, not just those with no GdkWindow wrapped around the X
window. Fix a FIXME about how the window could be a pixmap using
RTTI; this of course assumes GDK_IS_WINDOW() is optimized.
Also, be robust against events not on a known GdkWindow.
* gdk/x11/gdkmain-x11.c (gdk_x11_grab_server,
gdk_x11_ungrab_server): export reference-counted server grabs, so
other people can grab server over a GDK function that also does
so.
Wed Jun 27 19:40:31 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c
......
......@@ -495,7 +495,6 @@ This can later be composited together with other
#GtkRcStyle structures to form a #GtkStyle.
</para>
@parent_instance:
@name:
@bg_pixmap_name:
@font_desc:
......
......@@ -42,12 +42,8 @@ GtkTreeViewColumn
@displayed_width:
@drag_x:
@drag_y:
@func:
@func_data:
@destroy:
@title:
@cell:
@attributes:
@cell_list:
@column_type:
@sort_clicked_signal:
@sort_column_changed_signal:
......@@ -103,6 +99,7 @@ GtkTreeViewColumn
</para>
@tree_column:
@cell_renderer:
@attribute:
@column:
......@@ -113,6 +110,7 @@ GtkTreeViewColumn
</para>
@tree_column:
@cell_renderer:
@Varargs:
......
......@@ -524,6 +524,11 @@ If the window can be resized to a smaller size by the user.
If the window can be resized to a larger size by the user.
</para>
<!-- ##### ARG GtkWindow:resizable ##### -->
<para>
</para>
<!-- ##### ARG GtkWindow:modal ##### -->
<para>
If the window is modal, i.e. it grabs all GTK+ events.
......
......@@ -722,7 +722,7 @@ gdk_window_paint_init_bg (GdkWindow *window,
* drawing operations performed on @window will be diverted to the
* backing store. When you call gdk_window_end_paint(), the backing
* store will be copied to @window, making it visible onscreen. Only
* the part of window contained in @region will be modified; that is,
* the part of @window contained in @region will be modified; that is,
* drawing operations are clipped to @region.
*
* The net result of all this is to remove flicker, because the user
......
......@@ -263,6 +263,7 @@ GdkWindow* gdk_window_at_pointer (gint *win_x,
void gdk_window_show (GdkWindow *window);
void gdk_window_hide (GdkWindow *window);
void gdk_window_withdraw (GdkWindow *window);
void gdk_window_show_unraised (GdkWindow *window);
void gdk_window_move (GdkWindow *window,
gint x,
gint y);
......
......@@ -1149,7 +1149,7 @@ motif_add_to_target_table (GList *targets)
*/
motif_find_drag_window (TRUE);
XGrabServer(gdk_display);
gdk_x11_grab_server ();
motif_read_target_table();
/* Check again, in case it was added in the meantime */
......@@ -1225,7 +1225,7 @@ motif_add_to_target_table (GList *targets)
8, PropModeReplace,
data, total_size);
}
XUngrabServer(gdk_display);
gdk_x11_ungrab_server ();
}
g_list_free (sorted);
......
......@@ -438,13 +438,31 @@ gdk_event_translate (GdkEvent *event,
gint xoffset, yoffset;
return_val = FALSE;
/* init these, since the done: block uses them */
window = NULL;
window_private = NULL;
event->any.window = NULL;
/* Find the GdkWindow that this event occurred in.
*
* We handle events with window=None
* specially - they are generated by XFree86's XInput under
* some circumstances.
*/
if (gdk_default_filters)
{
/* Apply global filters */
GdkFilterReturn result;
result = gdk_event_apply_filters (xevent, event,
gdk_default_filters);
if (result != GDK_FILTER_CONTINUE)
{
return_val = (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
goto done;
}
}
/* We handle events with window=None
* specially - they are generated by XFree86's XInput under
* some circumstances. This handling for obvious reasons
* goes before we bother to lookup the event window.
*/
if (xevent->xany.window == None)
{
......@@ -455,53 +473,40 @@ gdk_event_translate (GdkEvent *event,
else
return_val = FALSE;
}
/* Find the GdkWindow that this event occurred in. */
window = gdk_window_lookup (xevent->xany.window);
window_private = (GdkWindowObject *) window;
if (_gdk_moveresize_window &&
(xevent->xany.type == MotionNotify ||
xevent->xany.type == ButtonRelease))
{
_gdk_moveresize_handle_event (xevent);
gdk_window_unref (window);
return FALSE;
}
if (wmspec_check_window != None &&
xevent->xany.window == wmspec_check_window)
{
if (xevent->type == DestroyNotify)
wmspec_check_window = None;
/* Eat events on this window unless someone had wrapped
* it as a foreign window
*/
if (window == NULL)
return FALSE;
}
/* FIXME: window might be a GdkPixmap!!! */
if (window != NULL)
{
window_impl = GDK_WINDOW_IMPL_X11 (window_private->impl);
/* Window may be a pixmap, so check its type.
* (This check is probably too expensive unless
* GLib short-circuits an exact type match,
* which has been proposed)
*/
if (GDK_IS_WINDOW (window))
{
window_impl = GDK_WINDOW_IMPL_X11 (window_private->impl);
if (xevent->xany.window != GDK_WINDOW_XID (window))
{
g_assert (xevent->xany.window == window_impl->focus_window);
switch (xevent->type)
{
case KeyPress:
case KeyRelease:
xevent->xany.window = GDK_WINDOW_XID (window);
break;
default:
return False;
}
}
if (xevent->xany.window != GDK_WINDOW_XID (window))
{
g_assert (xevent->xany.window == window_impl->focus_window);
switch (xevent->type)
{
case KeyPress:
case KeyRelease:
xevent->xany.window = GDK_WINDOW_XID (window);
break;
default:
return False;
}
}
}
gdk_window_ref (window);
g_object_ref (G_OBJECT (window));
}
event->any.window = window;
......@@ -512,15 +517,12 @@ gdk_event_translate (GdkEvent *event,
if (xevent->type != DestroyNotify)
return FALSE;
}
else
else if (window_private)
{
/* Check for filters for this window
*/
/* Apply per-window filters */
GdkFilterReturn result;
result = gdk_event_apply_filters (xevent, event,
window_private
?window_private->filters
:gdk_default_filters);
window_private->filters);
if (result != GDK_FILTER_CONTINUE)
{
......@@ -528,7 +530,30 @@ gdk_event_translate (GdkEvent *event,
goto done;
}
}
if (wmspec_check_window != None &&
xevent->xany.window == wmspec_check_window)
{
if (xevent->type == DestroyNotify)
wmspec_check_window = None;
/* Eat events on this window unless someone had wrapped
* it as a foreign window
*/
if (window == NULL)
return FALSE;
}
if (window &&
_gdk_moveresize_window &&
(xevent->xany.type == MotionNotify ||
xevent->xany.type == ButtonRelease))
{
_gdk_moveresize_handle_event (xevent);
gdk_window_unref (window);
return FALSE;
}
/* We do a "manual" conversion of the XEvent to a
* GdkEvent. The structures are mostly the same so
* the conversion is fairly straightforward. We also
......@@ -547,10 +572,16 @@ gdk_event_translate (GdkEvent *event,
xoffset = 0;
yoffset = 0;
}
switch (xevent->type)
{
case KeyPress:
if (window_private == NULL)
{
return_val = FALSE;
break;
}
/* Lookup the string corresponding to the given keysym.
*/
......@@ -593,6 +624,12 @@ gdk_event_translate (GdkEvent *event,
break;
case KeyRelease:
if (window_private == NULL)
{
return_val = FALSE;
break;
}
/* Lookup the string corresponding to the given keysym.
*/
......@@ -640,9 +677,9 @@ gdk_event_translate (GdkEvent *event,
xevent->xbutton.x, xevent->xbutton.y,
xevent->xbutton.button));
if (window_private &&
(window_private->extension_events != 0) &&
gdk_input_ignore_core)
if (window_private == NULL ||
((window_private->extension_events != 0) &&
gdk_input_ignore_core))
{
return_val = FALSE;
break;
......@@ -703,9 +740,9 @@ gdk_event_translate (GdkEvent *event,
xevent->xbutton.x, xevent->xbutton.y,
xevent->xbutton.button));
if (window_private &&
(window_private->extension_events != 0) &&
gdk_input_ignore_core)
if (window_private == NULL ||
((window_private->extension_events != 0) &&
gdk_input_ignore_core))
{
return_val = FALSE;
break;
......@@ -740,9 +777,9 @@ gdk_event_translate (GdkEvent *event,
xevent->xmotion.x, xevent->xmotion.y,
(xevent->xmotion.is_hint) ? "true" : "false"));
if (window_private &&
(window_private->extension_events != 0) &&
gdk_input_ignore_core)
if (window_private == NULL ||
((window_private->extension_events != 0) &&
gdk_input_ignore_core))
{
return_val = FALSE;
break;
......@@ -768,7 +805,13 @@ gdk_event_translate (GdkEvent *event,
xevent->xcrossing.window,
xevent->xcrossing.detail,
xevent->xcrossing.subwindow));
if (window_private == NULL)
{
return_val = FALSE;
break;
}
/* Handle focusing (in the case where no window manager is running */
if (window &&
GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
......@@ -855,6 +898,12 @@ gdk_event_translate (GdkEvent *event,
g_message ("leave notify:\t\twindow: %ld detail: %d subwin: %ld",
xevent->xcrossing.window,
xevent->xcrossing.detail, xevent->xcrossing.subwindow));
if (window_private == NULL)
{
return_val = FALSE;
break;
}
/* Handle focusing (in the case where no window manager is running */
if (window &&
......@@ -1017,6 +1066,13 @@ gdk_event_translate (GdkEvent *event,
xevent->xexpose.x, xevent->xexpose.y,
xevent->xexpose.width, xevent->xexpose.height,
event->any.send_event ? " (send)" : ""));
if (window_private == NULL)
{
return_val = FALSE;
break;
}
{
GdkRectangle expose_rect;
......@@ -1054,7 +1110,13 @@ gdk_event_translate (GdkEvent *event,
GDK_NOTE (EVENTS,
g_message ("graphics expose:\tdrawable: %ld",
xevent->xgraphicsexpose.drawable));
if (window_private == NULL)
{
return_val = FALSE;
break;
}
expose_rect.x = xevent->xgraphicsexpose.x + xoffset;
expose_rect.y = xevent->xgraphicsexpose.y + yoffset;
expose_rect.width = xevent->xgraphicsexpose.width;
......@@ -1110,6 +1172,12 @@ gdk_event_translate (GdkEvent *event,
}
#endif /* G_ENABLE_DEBUG */
if (window_private == NULL)
{
return_val = FALSE;
break;
}
event->visibility.type = GDK_VISIBILITY_NOTIFY;
event->visibility.window = window;
......@@ -1296,6 +1364,12 @@ gdk_event_translate (GdkEvent *event,
atom ? "\"" : "");
g_free (atom);
);
if (window_private == NULL)
{
return_val = FALSE;
break;
}
event->property.type = GDK_PROPERTY_NOTIFY;
event->property.window = window;
......@@ -1406,13 +1480,21 @@ gdk_event_translate (GdkEvent *event,
break;
case GDK_FILTER_CONTINUE:
/* Send unknown ClientMessage's on to Gtk for it to use */
event->client.type = GDK_CLIENT_EVENT;
event->client.window = window;
event->client.message_type = xevent->xclient.message_type;
event->client.data_format = xevent->xclient.format;
memcpy(&event->client.data, &xevent->xclient.data,
sizeof(event->client.data));
}
if (window_private == NULL)
{
return_val = FALSE;
}
else
{
event->client.type = GDK_CLIENT_EVENT;
event->client.window = window;
event->client.message_type = xevent->xclient.message_type;
event->client.data_format = xevent->xclient.format;
memcpy(&event->client.data, &xevent->xclient.data,
sizeof(event->client.data));
}
break;
}
}
break;
......
......@@ -709,7 +709,7 @@ _gdk_window_process_expose (GdkWindow *window,
GdkRegion *invalidate_region = gdk_region_rectangle (area);
GdkRegion *clip_region;
GSList *tmp_list = translate_queue;
impl = GDK_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (window)->impl);
while (tmp_list)
......@@ -747,7 +747,7 @@ _gdk_window_process_expose (GdkWindow *window,
if (!gdk_region_empty (invalidate_region))
gdk_window_invalidate_region (window, invalidate_region, FALSE);
gdk_region_destroy (invalidate_region);
gdk_region_destroy (clip_region);
}
......
......@@ -751,3 +751,23 @@ _gdk_region_get_xrectangles (GdkRegion *region,
*rects = rectangles;
*n_rects = region->numRects;
}
/* FIXME put in GdkDisplay */
static gint grab_count = 0;
void
gdk_x11_grab_server (void)
{
if (grab_count == 0)
XGrabServer (gdk_display);
++grab_count;
}
void
gdk_x11_ungrab_server (void)
{
g_return_if_fail (grab_count > 0);
--grab_count;
if (grab_count == 0)
XUngrabServer (gdk_display);
}
......@@ -807,8 +807,9 @@ set_initial_hints (GdkWindow *window)
}
}
void
gdk_window_show (GdkWindow *window)
static void
show_window_internal (GdkWindow *window,
gboolean raise)
{
GdkWindowObject *private;
......@@ -817,8 +818,9 @@ gdk_window_show (GdkWindow *window)
private = (GdkWindowObject*) window;
if (!private->destroyed)
{
XRaiseWindow (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window));
if (raise)
XRaiseWindow (GDK_WINDOW_XDISPLAY (window),