forked from AuroraMiddleware/gtk
gdk: Drop map events
We are really inconsistent about generating these, and they are not actually used in GTK+. Instead, add a boolean GdkSurface::mapped property.
This commit is contained in:
parent
1172810768
commit
7ca6440f4d
@ -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));
|
||||
|
||||
|
@ -821,8 +821,6 @@ gdk_event_get_time (const GdkEvent *event)
|
||||
case GDK_NOTHING:
|
||||
case GDK_DELETE:
|
||||
case GDK_DESTROY:
|
||||
case GDK_MAP:
|
||||
case GDK_UNMAP:
|
||||
case GDK_GRAB_BROKEN:
|
||||
case GDK_EVENT_LAST:
|
||||
default:
|
||||
@ -895,8 +893,6 @@ gdk_event_get_state (const GdkEvent *event,
|
||||
case GDK_NOTHING:
|
||||
case GDK_DELETE:
|
||||
case GDK_DESTROY:
|
||||
case GDK_MAP:
|
||||
case GDK_UNMAP:
|
||||
case GDK_GRAB_BROKEN:
|
||||
case GDK_PAD_BUTTON_PRESS:
|
||||
case GDK_PAD_BUTTON_RELEASE:
|
||||
|
@ -151,8 +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_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
|
||||
@ -208,8 +206,6 @@ typedef enum
|
||||
GDK_ENTER_NOTIFY,
|
||||
GDK_LEAVE_NOTIFY,
|
||||
GDK_FOCUS_CHANGE,
|
||||
GDK_MAP,
|
||||
GDK_UNMAP,
|
||||
GDK_PROXIMITY_IN,
|
||||
GDK_PROXIMITY_OUT,
|
||||
GDK_DRAG_ENTER,
|
||||
|
@ -107,6 +107,7 @@ enum {
|
||||
PROP_CURSOR,
|
||||
PROP_DISPLAY,
|
||||
PROP_STATE,
|
||||
PROP_MAPPED,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
@ -273,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);
|
||||
|
||||
/**
|
||||
@ -443,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;
|
||||
@ -973,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;
|
||||
}
|
||||
}
|
||||
@ -2270,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);
|
||||
@ -2285,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);
|
||||
@ -2549,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)
|
||||
@ -2595,14 +2602,6 @@ 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);
|
||||
@ -2620,7 +2619,6 @@ void
|
||||
gdk_surface_withdraw (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplClass *impl_class;
|
||||
gboolean was_mapped;
|
||||
GdkGLContext *current_context;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
@ -2628,21 +2626,11 @@ gdk_surface_withdraw (GdkSurface *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 ();
|
||||
@ -3939,8 +3927,6 @@ _gdk_make_event (GdkSurface *surface,
|
||||
break;
|
||||
|
||||
case GDK_FOCUS_CHANGE:
|
||||
case GDK_MAP:
|
||||
case GDK_UNMAP:
|
||||
case GDK_DELETE:
|
||||
case GDK_DESTROY:
|
||||
default:
|
||||
@ -5496,6 +5482,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)
|
||||
@ -5506,8 +5493,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
|
||||
@ -5519,12 +5510,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
|
||||
|
@ -2628,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
|
||||
|
@ -785,8 +785,6 @@ _gdk_win32_print_event (const GdkEvent *event)
|
||||
CASE (GDK_ENTER_NOTIFY);
|
||||
CASE (GDK_LEAVE_NOTIFY);
|
||||
CASE (GDK_FOCUS_CHANGE);
|
||||
CASE (GDK_MAP);
|
||||
CASE (GDK_UNMAP);
|
||||
CASE (GDK_PROXIMITY_IN);
|
||||
CASE (GDK_PROXIMITY_OUT);
|
||||
CASE (GDK_DRAG_ENTER);
|
||||
@ -3106,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))
|
||||
{
|
||||
@ -3173,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);
|
||||
|
||||
|
@ -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:
|
||||
|
@ -1827,22 +1827,7 @@ gtk_main_do_event (GdkEvent *event)
|
||||
}
|
||||
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_FOCUS_CHANGE:
|
||||
case GDK_UNMAP:
|
||||
case GDK_GRAB_BROKEN:
|
||||
if (!_gtk_widget_captured_event (event_widget, event))
|
||||
gtk_widget_event (event_widget, event);
|
||||
|
@ -5270,8 +5270,6 @@ gtk_widget_event_internal (GtkWidget *widget,
|
||||
case GDK_NOTHING:
|
||||
case GDK_DELETE:
|
||||
case GDK_DESTROY:
|
||||
case GDK_MAP:
|
||||
case GDK_UNMAP:
|
||||
return gtk_widget_emit_event_signals (widget, event);
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user