Merge branch 'wip/matthiasc/kill-non-input-events' into 'master'

Wip/matthiasc/kill non input events

See merge request GNOME/gtk!242
This commit is contained in:
Matthias Clasen 2018-07-15 19:50:37 +00:00
commit 17386b5cf7
17 changed files with 159 additions and 344 deletions

View File

@ -193,7 +193,6 @@ gdk_surface_is_visible
gdk_surface_is_viewable
gdk_surface_is_input_only
gdk_surface_get_state
gdk_surface_withdraw
gdk_surface_iconify
gdk_surface_deiconify
gdk_surface_stick

View File

@ -304,16 +304,9 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
{
surface->x = message->configure_notify.x;
surface->y = message->configure_notify.y;
event = gdk_event_new (GDK_CONFIGURE);
event->any.surface = g_object_ref (surface);
event->configure.x = message->configure_notify.x;
event->configure.y = message->configure_notify.y;
event->configure.width = message->configure_notify.width;
event->configure.height = message->configure_notify.height;
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
surface->width = message->configure_notify.width;
surface->height = message->configure_notify.height;
g_signal_emit_by_name (surface, "size-changed", surface->width, surface->height);
if (surface->resize_count >= 1)
{

View File

@ -322,10 +322,7 @@ gdk_surface_broadway_show (GdkSurface *surface,
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
impl->visible = TRUE;
_gdk_make_event (GDK_SURFACE (surface), GDK_MAP, NULL, FALSE);
if (surface->parent)
_gdk_make_event (GDK_SURFACE (surface), GDK_MAP, NULL, FALSE);
/* FIXME: update state ? */
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
if (_gdk_broadway_server_surface_show (broadway_display->server, impl->id))
@ -342,10 +339,7 @@ gdk_surface_broadway_hide (GdkSurface *surface)
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
impl->visible = FALSE;
_gdk_make_event (GDK_SURFACE (surface), GDK_UNMAP, NULL, FALSE);
if (surface->parent)
_gdk_make_event (GDK_SURFACE (surface), GDK_UNMAP, NULL, FALSE);
/* FIXME: update state ? */
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));

View File

@ -646,11 +646,6 @@ gdk_event_copy (const GdkEvent *event)
g_object_ref (event->dnd.drop);
break;
case GDK_EXPOSE:
if (event->expose.region)
new_event->expose.region = cairo_region_copy (event->expose.region);
break;
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
if (event->button.axes)
@ -730,11 +725,6 @@ gdk_event_finalize (GObject *object)
g_free (event->touch.axes);
break;
case GDK_EXPOSE:
if (event->expose.region)
cairo_region_destroy (event->expose.region);
break;
case GDK_MOTION_NOTIFY:
g_clear_object (&event->motion.tool);
g_free (event->motion.axes);
@ -827,14 +817,10 @@ gdk_event_get_time (const GdkEvent *event)
return event->pad_axis.time;
case GDK_PAD_GROUP_MODE:
return event->pad_group_mode.time;
case GDK_CONFIGURE:
case GDK_FOCUS_CHANGE:
case GDK_NOTHING:
case GDK_DELETE:
case GDK_DESTROY:
case GDK_EXPOSE:
case GDK_MAP:
case GDK_UNMAP:
case GDK_GRAB_BROKEN:
case GDK_EVENT_LAST:
default:
@ -897,7 +883,6 @@ gdk_event_get_state (const GdkEvent *event,
case GDK_LEAVE_NOTIFY:
*state = event->crossing.state;
return TRUE;
case GDK_CONFIGURE:
case GDK_FOCUS_CHANGE:
case GDK_PROXIMITY_IN:
case GDK_PROXIMITY_OUT:
@ -908,9 +893,6 @@ gdk_event_get_state (const GdkEvent *event,
case GDK_NOTHING:
case GDK_DELETE:
case GDK_DESTROY:
case GDK_EXPOSE:
case GDK_MAP:
case GDK_UNMAP:
case GDK_GRAB_BROKEN:
case GDK_PAD_BUTTON_PRESS:
case GDK_PAD_BUTTON_RELEASE:
@ -949,10 +931,6 @@ gdk_event_get_coords (const GdkEvent *event,
switch ((guint) event->any.type)
{
case GDK_CONFIGURE:
x = event->configure.x;
y = event->configure.y;
break;
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
x = event->crossing.x;
@ -1083,10 +1061,6 @@ gdk_event_set_coords (GdkEvent *event,
switch ((guint) event->any.type)
{
case GDK_CONFIGURE:
event->configure.x = x;
event->configure.y = y;
break;
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
event->crossing.x = x;

View File

@ -104,7 +104,6 @@ G_BEGIN_DECLS
typedef struct _GdkEventAny GdkEventAny;
typedef struct _GdkEventExpose GdkEventExpose;
typedef struct _GdkEventMotion GdkEventMotion;
typedef struct _GdkEventButton GdkEventButton;
typedef struct _GdkEventTouch GdkEventTouch;
@ -112,7 +111,6 @@ typedef struct _GdkEventScroll GdkEventScroll;
typedef struct _GdkEventKey GdkEventKey;
typedef struct _GdkEventFocus GdkEventFocus;
typedef struct _GdkEventCrossing GdkEventCrossing;
typedef struct _GdkEventConfigure GdkEventConfigure;
typedef struct _GdkEventProximity GdkEventProximity;
typedef struct _GdkEventDND GdkEventDND;
typedef struct _GdkEventSetting GdkEventSetting;
@ -145,8 +143,6 @@ typedef void (*GdkEventFunc) (GdkEvent *event,
* hidden or destroyed, usually when the user clicks on a special icon in the
* title bar.
* @GDK_DESTROY: the surface has been destroyed.
* @GDK_EXPOSE: all or part of the surface has become visible and needs to be
* redrawn.
* @GDK_MOTION_NOTIFY: the pointer (usually a mouse) has moved.
* @GDK_BUTTON_PRESS: a mouse button has been pressed.
* @GDK_BUTTON_RELEASE: a mouse button has been released.
@ -155,10 +151,6 @@ typedef void (*GdkEventFunc) (GdkEvent *event,
* @GDK_ENTER_NOTIFY: the pointer has entered the surface.
* @GDK_LEAVE_NOTIFY: the pointer has left the surface.
* @GDK_FOCUS_CHANGE: the keyboard focus has entered or left the surface.
* @GDK_CONFIGURE: the size, position or stacking order of the surface has changed.
* Note that GTK+ discards these events for %GDK_SURFACE_CHILD surfaces.
* @GDK_MAP: the surface has been mapped.
* @GDK_UNMAP: the surface has been unmapped.
* @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing
* surface (e.g. a touchscreen or graphics tablet).
* @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing
@ -206,7 +198,6 @@ typedef enum
GDK_NOTHING,
GDK_DELETE,
GDK_DESTROY,
GDK_EXPOSE,
GDK_MOTION_NOTIFY,
GDK_BUTTON_PRESS,
GDK_BUTTON_RELEASE,
@ -215,9 +206,6 @@ typedef enum
GDK_ENTER_NOTIFY,
GDK_LEAVE_NOTIFY,
GDK_FOCUS_CHANGE,
GDK_CONFIGURE,
GDK_MAP,
GDK_UNMAP,
GDK_PROXIMITY_IN,
GDK_PROXIMITY_OUT,
GDK_DRAG_ENTER,

View File

@ -63,23 +63,6 @@ struct _GdkEventAny
GdkDisplay *display;
};
/*
* GdkEventExpose:
* @type: the type of the event (%GDK_EXPOSE)
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @area: bounding box of @region.
* @region: the region that needs to be redrawn.
*
* Generated when all or part of a surface becomes visible and needs to be
* redrawn.
*/
struct _GdkEventExpose
{
GdkEventAny any;
cairo_region_t *region;
};
/*
* GdkEventMotion:
* @type: the type of the event.
@ -351,26 +334,6 @@ struct _GdkEventFocus
gint16 in;
};
/*
* GdkEventConfigure:
* @type: the type of the event (%GDK_CONFIGURE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @x: the new x coordinate of the surface, relative to its parent.
* @y: the new y coordinate of the surface, relative to its parent.
* @width: the new width of the surface.
* @height: the new height of the surface.
*
* Generated when a surface size or position has changed.
*/
struct _GdkEventConfigure
{
GdkEventAny any;
gint x, y;
gint width;
gint height;
};
/*
* GdkEventProximity:
* @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
@ -593,7 +556,6 @@ struct _GdkEventPadGroupMode {
* GdkEvent:
* @type: the #GdkEventType
* @any: a #GdkEventAny
* @expose: a #GdkEventExpose
* @motion: a #GdkEventMotion
* @button: a #GdkEventButton
* @touch: a #GdkEventTouch
@ -601,7 +563,6 @@ struct _GdkEventPadGroupMode {
* @key: a #GdkEventKey
* @crossing: a #GdkEventCrossing
* @focus_change: a #GdkEventFocus
* @configure: a #GdkEventConfigure
* @proximity: a #GdkEventProximity
* @dnd: a #GdkEventDND
* @grab_broken: a #GdkEventGrabBroken
@ -645,7 +606,6 @@ struct _GdkEventPadGroupMode {
union _GdkEvent
{
GdkEventAny any;
GdkEventExpose expose;
GdkEventMotion motion;
GdkEventButton button;
GdkEventTouch touch;
@ -653,7 +613,6 @@ union _GdkEvent
GdkEventKey key;
GdkEventCrossing crossing;
GdkEventFocus focus_change;
GdkEventConfigure configure;
GdkEventProximity proximity;
GdkEventDND dnd;
GdkEventGrabBroken grab_broken;

View File

@ -97,6 +97,8 @@
enum {
MOVED_TO_RECT,
SIZE_CHANGED,
RENDER,
LAST_SIGNAL
};
@ -105,6 +107,7 @@ enum {
PROP_CURSOR,
PROP_DISPLAY,
PROP_STATE,
PROP_MAPPED,
LAST_PROP
};
@ -271,6 +274,13 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
GDK_TYPE_SURFACE_STATE, GDK_SURFACE_STATE_WITHDRAWN,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
properties[PROP_MAPPED] =
g_param_spec_boolean ("mapped",
P_("Mapped"),
P_("Mapped"),
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, properties);
/**
@ -310,6 +320,31 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
G_TYPE_POINTER,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN);
signals[SIZE_CHANGED] =
g_signal_new (g_intern_static_string ("size-changed"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0,
NULL,
NULL,
NULL,
G_TYPE_NONE,
2,
G_TYPE_INT,
G_TYPE_INT);
signals[RENDER] =
g_signal_new (g_intern_static_string ("render"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
0,
g_signal_accumulator_true_handled,
NULL,
NULL,
G_TYPE_BOOLEAN,
1,
CAIRO_GOBJECT_TYPE_REGION);
}
static void
@ -416,6 +451,10 @@ gdk_surface_get_property (GObject *object,
g_value_set_flags (value, surface->state);
break;
case PROP_MAPPED:
g_value_set_boolean (value, GDK_SURFACE_IS_MAPPED (surface));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -946,6 +985,7 @@ _gdk_surface_destroy_hierarchy (GdkSurface *surface,
surface_remove_from_pointer_info (surface, display);
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
break;
}
}
@ -1617,20 +1657,13 @@ static void
gdk_surface_process_updates_recurse (GdkSurface *surface,
cairo_region_t *expose_region)
{
GdkEvent *event;
gboolean handled;
if (surface->destroyed)
return;
/* Paint the surface before the children, clipped to the surface region */
event = gdk_event_new (GDK_EXPOSE);
event->any.surface = g_object_ref (surface);
event->any.send_event = FALSE;
event->expose.region = cairo_region_reference (expose_region);
_gdk_event_emit (event);
g_object_unref (event);
g_signal_emit (surface, signals[RENDER], 0, expose_region, &handled);
}
/* Process and remove any invalid area on the native surface by creating
@ -2250,6 +2283,7 @@ gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
{
surface->state = 0;
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
}
did_show = _gdk_surface_update_viewable (surface);
@ -2265,14 +2299,6 @@ gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
impl_class->show (surface, !did_show ? was_mapped : TRUE);
}
if (!was_mapped && !gdk_surface_has_impl (surface))
{
_gdk_make_event (surface, GDK_MAP, NULL, FALSE);
if (surface->parent)
_gdk_make_event (surface, GDK_MAP, NULL, FALSE);
}
if (!was_mapped || did_raise)
{
recompute_visible_regions (surface, FALSE);
@ -2308,7 +2334,7 @@ gdk_surface_show_unraised (GdkSurface *surface)
* other surfaces with the same parent surface appear below @surface.
* This is true whether or not the surfaces are visible.
*
* If @surface is a toplevel, the surface manager may choose to deny the
* If @surface is a toplevel, the window manager may choose to deny the
* request to move the surface in the Z-order, gdk_surface_raise() only
* requests the restack, does not guarantee it.
*/
@ -2529,6 +2555,7 @@ gdk_surface_hide (GdkSurface *surface)
{
surface->state = GDK_SURFACE_STATE_WITHDRAWN;
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
}
if (was_mapped)
@ -2575,62 +2602,11 @@ G_GNUC_END_IGNORE_DEPRECATIONS
recompute_visible_regions (surface, FALSE);
if (was_mapped && !gdk_surface_has_impl (surface))
{
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
if (surface->parent)
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
}
/* Invalidate the rect */
if (was_mapped)
gdk_surface_invalidate_in_parent (surface);
}
/**
* gdk_surface_withdraw:
* @surface: a toplevel #GdkSurface
*
* Withdraws a surface (unmaps it and asks the surface manager to forget about it).
* This function is not really useful as gdk_surface_hide() automatically
* withdraws toplevel surfaces before hiding them.
**/
void
gdk_surface_withdraw (GdkSurface *surface)
{
GdkSurfaceImplClass *impl_class;
gboolean was_mapped;
GdkGLContext *current_context;
g_return_if_fail (GDK_IS_SURFACE (surface));
if (surface->destroyed)
return;
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
if (gdk_surface_has_impl (surface))
{
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
impl_class->withdraw (surface);
if (was_mapped)
{
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
if (surface->parent)
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
}
current_context = gdk_gl_context_get_current ();
if (current_context != NULL && gdk_gl_context_get_surface (current_context) == surface)
gdk_gl_context_clear_current ();
recompute_visible_regions (surface, FALSE);
}
}
static void
gdk_surface_move_resize_toplevel (GdkSurface *surface,
gboolean with_move,
@ -2663,6 +2639,7 @@ gdk_surface_move_resize_internal (GdkSurface *surface,
{
cairo_region_t *old_region, *new_region;
gboolean expose;
gboolean size_changed;
g_return_if_fail (GDK_IS_SURFACE (surface));
@ -2691,6 +2668,7 @@ gdk_surface_move_resize_internal (GdkSurface *surface,
/* Handle child surfaces */
expose = FALSE;
size_changed = FALSE;
old_region = NULL;
if (gdk_surface_is_viewable (surface) &&
@ -2716,8 +2694,16 @@ gdk_surface_move_resize_internal (GdkSurface *surface,
}
if (!(width < 0 && height < 0))
{
surface->width = width;
surface->height = height;
if (surface->width != width)
{
surface->width = width;
size_changed = TRUE;
}
if (surface->height != height)
{
surface->height = height;
size_changed = TRUE;
}
}
recompute_visible_regions (surface, FALSE);
@ -2740,10 +2726,11 @@ gdk_surface_move_resize_internal (GdkSurface *surface,
cairo_region_destroy (old_region);
cairo_region_destroy (new_region);
}
if (size_changed)
g_signal_emit (surface, signals[SIZE_CHANGED], 0, width, height);
}
/**
* gdk_surface_move:
* @surface: a #GdkSurface
@ -3445,7 +3432,7 @@ gdk_surface_merge_child_input_shapes (GdkSurface *surface)
* gdk_surface_get_modal_hint:
* @surface: A toplevel #GdkSurface.
*
* Determines whether or not the surface manager is hinted that @surface
* Determines whether or not the window manager is hinted that @surface
* has modal behaviour.
*
* Returns: whether or not the surface has the modal hint set.
@ -3908,12 +3895,8 @@ _gdk_make_event (GdkSurface *surface,
break;
case GDK_FOCUS_CHANGE:
case GDK_CONFIGURE:
case GDK_MAP:
case GDK_UNMAP:
case GDK_DELETE:
case GDK_DESTROY:
case GDK_EXPOSE:
default:
break;
}
@ -4427,7 +4410,7 @@ gdk_surface_set_transient_for (GdkSurface *surface,
* @x: (out): return location for X position of surface frame
* @y: (out): return location for Y position of surface frame
*
* Obtains the top-left corner of the surface manager frame in root
* Obtains the top-left corner of the window manager frame in root
* surface coordinates.
*
**/
@ -5467,6 +5450,7 @@ void
gdk_surface_set_state (GdkSurface *surface,
GdkSurfaceState new_state)
{
gboolean was_mapped, mapped;
g_return_if_fail (GDK_IS_SURFACE (surface));
if (new_state == surface->state)
@ -5477,8 +5461,12 @@ gdk_surface_set_state (GdkSurface *surface,
* inconsistent state to the user.
*/
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
surface->state = new_state;
mapped = GDK_SURFACE_IS_MAPPED (surface);
_gdk_surface_update_viewable (surface);
/* We only really send the event to toplevels, since
@ -5490,12 +5478,15 @@ gdk_surface_set_state (GdkSurface *surface,
{
case GDK_SURFACE_TOPLEVEL:
case GDK_SURFACE_TEMP: /* ? */
g_object_notify (G_OBJECT (surface), "state");
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
break;
case GDK_SURFACE_CHILD:
default:
break;
}
if (was_mapped != mapped)
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
}
void

View File

@ -460,8 +460,6 @@ void gdk_surface_show (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_hide (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_withdraw (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_show_unraised (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_move (GdkSurface *surface,

View File

@ -698,20 +698,9 @@ gdk_wayland_surface_configure (GdkSurface *surface,
int height,
int scale)
{
GdkDisplay *display;
GdkEvent *event;
event = gdk_event_new (GDK_CONFIGURE);
event->any.surface = g_object_ref (surface);
event->any.send_event = FALSE;
event->configure.width = width;
event->configure.height = height;
gdk_wayland_surface_update_size (surface, width, height, scale);
_gdk_surface_update_size (surface);
display = gdk_surface_get_display (surface);
_gdk_wayland_display_deliver_event (display, event);
g_signal_emit_by_name (surface, "size-changed", width, height);
}
static gboolean
@ -2639,8 +2628,6 @@ gdk_wayland_surface_show (GdkSurface *surface,
gdk_wayland_surface_create_surface (surface);
gdk_wayland_surface_map (surface);
_gdk_make_event (surface, GDK_MAP, NULL, FALSE);
}
static void

View File

@ -777,7 +777,6 @@ _gdk_win32_print_event (const GdkEvent *event)
CASE (GDK_NOTHING);
CASE (GDK_DELETE);
CASE (GDK_DESTROY);
CASE (GDK_EXPOSE);
CASE (GDK_MOTION_NOTIFY);
CASE (GDK_BUTTON_PRESS);
CASE (GDK_BUTTON_RELEASE);
@ -786,9 +785,6 @@ _gdk_win32_print_event (const GdkEvent *event)
CASE (GDK_ENTER_NOTIFY);
CASE (GDK_LEAVE_NOTIFY);
CASE (GDK_FOCUS_CHANGE);
CASE (GDK_CONFIGURE);
CASE (GDK_MAP);
CASE (GDK_UNMAP);
CASE (GDK_PROXIMITY_IN);
CASE (GDK_PROXIMITY_OUT);
CASE (GDK_DRAG_ENTER);
@ -807,8 +803,6 @@ _gdk_win32_print_event (const GdkEvent *event)
switch (event->any.type)
{
case GDK_EXPOSE:
break;
case GDK_MOTION_NOTIFY:
g_print ("(%.4g,%.4g) (%.4g,%.4g)",
event->motion.x, event->motion.y,
@ -861,11 +855,6 @@ _gdk_win32_print_event (const GdkEvent *event)
case GDK_FOCUS_CHANGE:
g_print ("%s", (event->focus_change.in ? "IN" : "OUT"));
break;
case GDK_CONFIGURE:
g_print ("x:%d y:%d w:%d h:%d",
event->configure.x, event->configure.y,
event->configure.width, event->configure.height);
break;
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
@ -1429,17 +1418,7 @@ _gdk_win32_do_emit_configure_event (GdkSurface *window,
_gdk_surface_update_size (window);
event = gdk_event_new (GDK_CONFIGURE);
event->any.surface = window;
event->configure.width = window->width;
event->configure.height = window->height;
event->configure.x = window->x;
event->configure.y = window->y;
_gdk_win32_append_event (event);
g_signal_emit_by_name (window, "size-changed", window->width, window->height);
}
void
@ -3125,15 +3104,6 @@ gdk_event_translate (MSG *msg,
gdk_device_ungrab (device, msg -> time);
}
/* Send MAP events */
if ((windowpos->flags & SWP_SHOWWINDOW) &&
!GDK_SURFACE_DESTROYED (window))
{
event = gdk_event_new (GDK_MAP);
event->any.surface = window;
_gdk_win32_append_event (event);
}
/* Update window state */
if (windowpos->flags & (SWP_STATECHANGED | SWP_SHOWWINDOW | SWP_HIDEWINDOW))
{
@ -3192,11 +3162,6 @@ gdk_event_translate (MSG *msg,
if ((windowpos->flags & SWP_HIDEWINDOW) &&
!GDK_SURFACE_DESTROYED (window))
{
/* Send UNMAP events */
event = gdk_event_new (GDK_UNMAP);
event->any.surface = window;
_gdk_win32_append_event (event);
/* Make transient parent the forground window when window unmaps */
impl = GDK_SURFACE_IMPL_WIN32 (window->impl);

View File

@ -848,9 +848,6 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
g_message ("unmap notify:\t\twindow: %ld",
xevent->xmap.window));
event->any.type = GDK_UNMAP;
event->any.surface = surface;
if (surface && !is_substructure)
{
/* If the WM supports the _NET_WM_STATE_HIDDEN hint, we do not want to
@ -885,6 +882,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
_gdk_x11_surface_grab_check_unmap (surface, xevent->xany.serial);
}
return_val = FALSE;
break;
case MapNotify:
@ -892,9 +891,6 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
g_message ("map notify:\t\twindow: %ld",
xevent->xmap.window));
event->any.type = GDK_MAP;
event->any.surface = surface;
if (surface && !is_substructure)
{
/* Unset iconified if it was set */
@ -907,6 +903,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
gdk_surface_thaw_toplevel_updates (surface);
}
return_val = FALSE;
break;
case ReparentNotify:
@ -960,11 +958,12 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
return_val = FALSE;
else
{
event->any.type = GDK_CONFIGURE;
event->any.surface = surface;
event->configure.width = (xevent->xconfigure.width + surface_impl->surface_scale - 1) / surface_impl->surface_scale;
event->configure.height = (xevent->xconfigure.height + surface_impl->surface_scale - 1) / surface_impl->surface_scale;
int x, y, width, height;
x = 0;
y = 0;
width = (xevent->xconfigure.width + surface_impl->surface_scale - 1) / surface_impl->surface_scale;
height = (xevent->xconfigure.height + surface_impl->surface_scale - 1) / surface_impl->surface_scale;
if (!xevent->xconfigure.send_event &&
!xevent->xconfigure.override_redirect &&
!GDK_SURFACE_DESTROYED (surface))
@ -981,31 +980,34 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
&tx, &ty,
&child_window))
{
event->configure.x = tx / surface_impl->surface_scale;
event->configure.y = ty / surface_impl->surface_scale;
x = tx / surface_impl->surface_scale;
y = ty / surface_impl->surface_scale;
}
gdk_x11_display_error_trap_pop_ignored (display);
}
else
{
event->configure.x = xevent->xconfigure.x / surface_impl->surface_scale;
event->configure.y = xevent->xconfigure.y / surface_impl->surface_scale;
x = xevent->xconfigure.x / surface_impl->surface_scale;
y = xevent->xconfigure.y / surface_impl->surface_scale;
}
if (!is_substructure)
{
surface->x = event->configure.x;
surface->y = event->configure.y;
surface->x = x;
surface->y = y;
if (surface_impl->unscaled_width != xevent->xconfigure.width ||
surface_impl->unscaled_height != xevent->xconfigure.height)
{
surface_impl->unscaled_width = xevent->xconfigure.width;
surface_impl->unscaled_height = xevent->xconfigure.height;
surface->width = event->configure.width;
surface->height = event->configure.height;
surface->width = width;
surface->height = height;
_gdk_surface_update_size (surface);
_gdk_x11_surface_update_size (surface_impl);
g_signal_emit_by_name (surface, "size-changed", width, height);
}
if (surface->resize_count >= 1)
@ -1014,8 +1016,10 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
if (surface->resize_count == 0)
_gdk_x11_moveresize_configure_done (display, surface);
}
}
}
return_val = FALSE;
}
break;

View File

@ -1284,35 +1284,6 @@ gdk_surface_x11_show (GdkSurface *surface, gboolean already_mapped)
gdk_x11_surface_apply_fullscreen_mode (surface);
}
static void
gdk_surface_x11_hide (GdkSurface *surface)
{
/* We'll get the unmap notify eventually, and handle it then,
* but checking here makes things more consistent if we are
* just doing stuff ourself.
*/
_gdk_x11_surface_grab_check_unmap (surface,
NextRequest (GDK_SURFACE_XDISPLAY (surface)));
/* You can't simply unmap toplevel surfaces. */
switch (surface->surface_type)
{
case GDK_SURFACE_TOPLEVEL:
case GDK_SURFACE_TEMP: /* ? */
gdk_surface_withdraw (surface);
return;
case GDK_SURFACE_CHILD:
default:
break;
}
_gdk_surface_clear_update_area (surface);
XUnmapWindow (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface));
}
static void
gdk_surface_x11_withdraw (GdkSurface *surface)
{
@ -1330,6 +1301,35 @@ gdk_surface_x11_withdraw (GdkSurface *surface)
}
}
static void
gdk_surface_x11_hide (GdkSurface *surface)
{
/* We'll get the unmap notify eventually, and handle it then,
* but checking here makes things more consistent if we are
* just doing stuff ourself.
*/
_gdk_x11_surface_grab_check_unmap (surface,
NextRequest (GDK_SURFACE_XDISPLAY (surface)));
/* You can't simply unmap toplevel surfaces. */
switch (surface->surface_type)
{
case GDK_SURFACE_TOPLEVEL:
case GDK_SURFACE_TEMP: /* ? */
gdk_surface_x11_withdraw (surface);
return;
case GDK_SURFACE_CHILD:
default:
break;
}
_gdk_surface_clear_update_area (surface);
XUnmapWindow (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface));
}
static inline void
surface_x11_move (GdkSurface *surface,
gint x,

View File

@ -1603,6 +1603,7 @@ on_status_toplevel_configure (GtkWidget *toplevel,
GdkEvent *event,
StatusWindow *status_window)
{
#if 0
if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
{
GdkRectangle rect;
@ -1625,6 +1626,7 @@ on_status_toplevel_configure (GtkWidget *toplevel,
gtk_window_move (GTK_WINDOW (status_window->window), rect.x, y);
}
}
#endif
return GDK_EVENT_PROPAGATE;
}

View File

@ -1827,37 +1827,7 @@ gtk_main_do_event (GdkEvent *event)
}
break;
case GDK_EXPOSE:
if (event->any.surface)
gtk_widget_render (event_widget, event->any.surface, event->expose.region);
break;
case GDK_MAP:
if (GTK_IS_WINDOW (event_widget) && !_gtk_widget_get_mapped (event_widget))
{
/* we should be be unmapped, but are getting a MapEvent, this may happen
* to toplevel XWindows if mapping was intercepted by a window manager
* and an unmap request occurred while the MapRequestEvent was still
* being handled. we work around this situation here by re-requesting
* the window being unmapped. more details can be found in:
* http://bugzilla.gnome.org/show_bug.cgi?id=316180
*/
gdk_surface_hide (_gtk_widget_get_surface (event_widget));
}
break;
case GDK_CONFIGURE:
if (GTK_IS_WINDOW (event_widget) &&
_gtk_widget_get_surface (event_widget) == event->any.surface)
{
gtk_window_configure (GTK_WINDOW (event_widget),
event->configure.width,
event->configure.height);
}
break;
case GDK_FOCUS_CHANGE:
case GDK_UNMAP:
case GDK_GRAB_BROKEN:
if (!_gtk_widget_captured_event (event_widget, event))
gtk_widget_event (event_widget, event);

View File

@ -5091,14 +5091,6 @@ gtk_widget_event (GtkWidget *widget,
g_return_val_if_fail (GTK_IS_WIDGET (widget), TRUE);
g_return_val_if_fail (WIDGET_REALIZED_FOR_EVENT (widget, event), TRUE);
if (event->any.type == GDK_EXPOSE)
{
g_warning ("Events of type GDK_EXPOSE cannot be synthesized. To get "
"the same effect, call gdk_surface_invalidate_rect/region(), "
"followed by gdk_surface_process_updates().");
return TRUE;
}
return gtk_widget_event_internal (widget, event);
}
@ -5174,14 +5166,6 @@ _gtk_widget_captured_event (GtkWidget *widget,
g_return_val_if_fail (GTK_IS_WIDGET (widget), TRUE);
g_return_val_if_fail (WIDGET_REALIZED_FOR_EVENT (widget, event), TRUE);
if (event->any.type == GDK_EXPOSE)
{
g_warning ("Events of type GDK_EXPOSE cannot be synthesized. To get "
"the same effect, call gdk_surface_invalidate_rect/region(), "
"followed by gdk_surface_process_updates().");
return TRUE;
}
if (!event_surface_is_still_viewable (event))
return TRUE;
@ -5217,7 +5201,6 @@ event_surface_is_still_viewable (const GdkEvent *event)
*/
switch ((guint) event->any.type)
{
case GDK_EXPOSE:
case GDK_MOTION_NOTIFY:
case GDK_BUTTON_PRESS:
case GDK_KEY_PRESS:
@ -5284,13 +5267,9 @@ gtk_widget_event_internal (GtkWidget *widget,
/* Non input events get handled right away */
switch ((guint) event->any.type)
{
case GDK_EXPOSE:
case GDK_NOTHING:
case GDK_DELETE:
case GDK_DESTROY:
case GDK_CONFIGURE:
case GDK_MAP:
case GDK_UNMAP:
return gtk_widget_emit_event_signals (widget, event);
default:
break;
@ -11513,6 +11492,16 @@ gtk_widget_set_surface (GtkWidget *widget,
}
}
static gboolean
surface_expose (GdkSurface *surface,
cairo_region_t *region,
GtkWidget *widget)
{
gtk_widget_render (widget, surface, region);
return TRUE;
}
/**
* gtk_widget_register_surface:
* @widget: a #GtkWidget
@ -11540,6 +11529,8 @@ gtk_widget_register_surface (GtkWidget *widget,
g_assert (user_data == NULL);
gdk_surface_set_user_data (surface, widget);
g_signal_connect (surface, "render", G_CALLBACK (surface_expose), widget);
}
/**
@ -11563,6 +11554,8 @@ gtk_widget_unregister_surface (GtkWidget *widget,
gdk_surface_get_user_data (surface, &user_data);
g_assert (user_data == widget);
gdk_surface_set_user_data (surface, NULL);
g_signal_handlers_disconnect_by_func (surface, surface_expose, widget);
}
/**

View File

@ -6293,7 +6293,7 @@ gtk_window_unmap (GtkWidget *widget)
surface = _gtk_widget_get_surface (widget);
GTK_WIDGET_CLASS (gtk_window_parent_class)->unmap (widget);
gdk_surface_withdraw (surface);
gdk_surface_hide (surface);
while (priv->configure_request_count > 0)
{
@ -6869,6 +6869,7 @@ gtk_window_realize (GtkWidget *widget)
gtk_widget_set_surface (widget, surface);
g_signal_connect_swapped (surface, "notify::state", G_CALLBACK (surface_state_changed), widget);
g_signal_connect_swapped (surface, "size-changed", G_CALLBACK (gtk_window_configure), widget);
gtk_widget_register_surface (widget, surface);
GTK_WIDGET_CLASS (gtk_window_parent_class)->realize (widget);
@ -7007,6 +7008,9 @@ gtk_window_unrealize (GtkWidget *widget)
g_signal_handlers_disconnect_by_func (_gtk_widget_get_surface (widget),
G_CALLBACK (surface_state_changed),
widget);
g_signal_handlers_disconnect_by_func (_gtk_widget_get_surface (widget),
G_CALLBACK (gtk_window_configure),
widget);
GTK_WIDGET_CLASS (gtk_window_parent_class)->unrealize (widget);

View File

@ -8,21 +8,14 @@ static GtkWidget *default_width_spin;
static GtkWidget *default_height_spin;
static GtkWidget *resizable_check;
static gboolean
configure_event_cb (GtkWidget *window, GdkEvent *event, GtkLabel *label)
static void
configure_event_cb (GtkWidget *window, int width, int height, GtkLabel *label)
{
if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
{
gchar *str;
gint width, height;
gchar *str;
gtk_window_get_size (GTK_WINDOW (window), &width, &height);
str = g_strdup_printf ("%d x %d", width, height);
gtk_label_set_label (label, str);
g_free (str);
}
return GDK_EVENT_PROPAGATE;
str = g_strdup_printf ("%d x %d", width, height);
gtk_label_set_label (label, str);
g_free (str);
}
static void
@ -71,7 +64,8 @@ show_dialog (void)
//gtk_widget_show (label);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), label, GTK_RESPONSE_HELP);
g_signal_connect (dialog, "event",
gtk_widget_realize (dialog);
g_signal_connect (gtk_widget_get_surface (dialog), "size-changed",
G_CALLBACK (configure_event_cb), label);
gtk_dialog_run (GTK_DIALOG (dialog));