gdk: Remove VisibilityNotify events

This commit is contained in:
Benjamin Otte 2017-11-01 21:59:45 +01:00
parent c0ccad56f9
commit bd6b6ed93c
13 changed files with 7 additions and 202 deletions

View File

@ -300,7 +300,6 @@ static gchar *types[] =
"GdkEvent ", "GdkEvent ",
"GdkEventKey ", "GdkEventKey ",
"GtkTextView ", "GtkTextView ",
"GdkEventVisibility ",
"GdkBitmap ", "GdkBitmap ",
"GtkTextChildAnchor ", "GtkTextChildAnchor ",
"GArray ", "GArray ",

View File

@ -788,7 +788,6 @@ GdkEventTouch
GdkEventScroll GdkEventScroll
GdkEventMotion GdkEventMotion
GdkEventExpose GdkEventExpose
GdkEventVisibility
GdkEventCrossing GdkEventCrossing
GdkEventFocus GdkEventFocus
GdkEventConfigure GdkEventConfigure
@ -807,7 +806,6 @@ GdkEventPadGroupMode
<SUBSECTION> <SUBSECTION>
GdkScrollDirection GdkScrollDirection
GdkVisibilityState
GdkCrossingMode GdkCrossingMode
GdkNotifyType GdkNotifyType
GdkPropertyState GdkPropertyState

View File

@ -917,7 +917,6 @@ gdk_event_get_time (const GdkEvent *event)
case GDK_PAD_GROUP_MODE: case GDK_PAD_GROUP_MODE:
return event->pad_group_mode.time; return event->pad_group_mode.time;
case GDK_CLIENT_EVENT: case GDK_CLIENT_EVENT:
case GDK_VISIBILITY_NOTIFY:
case GDK_CONFIGURE: case GDK_CONFIGURE:
case GDK_FOCUS_CHANGE: case GDK_FOCUS_CHANGE:
case GDK_NOTHING: case GDK_NOTHING:
@ -991,7 +990,6 @@ gdk_event_get_state (const GdkEvent *event,
*state = event->crossing.state; *state = event->crossing.state;
return TRUE; return TRUE;
case GDK_PROPERTY_NOTIFY: case GDK_PROPERTY_NOTIFY:
case GDK_VISIBILITY_NOTIFY:
case GDK_CLIENT_EVENT: case GDK_CLIENT_EVENT:
case GDK_CONFIGURE: case GDK_CONFIGURE:
case GDK_FOCUS_CHANGE: case GDK_FOCUS_CHANGE:

View File

@ -123,7 +123,6 @@ G_BEGIN_DECLS
typedef struct _GdkEventAny GdkEventAny; typedef struct _GdkEventAny GdkEventAny;
typedef struct _GdkEventExpose GdkEventExpose; typedef struct _GdkEventExpose GdkEventExpose;
typedef struct _GdkEventVisibility GdkEventVisibility;
typedef struct _GdkEventMotion GdkEventMotion; typedef struct _GdkEventMotion GdkEventMotion;
typedef struct _GdkEventButton GdkEventButton; typedef struct _GdkEventButton GdkEventButton;
typedef struct _GdkEventTouch GdkEventTouch; typedef struct _GdkEventTouch GdkEventTouch;
@ -250,7 +249,6 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
* @GDK_DROP_START: a drop operation onto the window has started. * @GDK_DROP_START: a drop operation onto the window has started.
* @GDK_DROP_FINISHED: the drop operation initiated by the window has completed. * @GDK_DROP_FINISHED: the drop operation initiated by the window has completed.
* @GDK_CLIENT_EVENT: a message has been received from another application. * @GDK_CLIENT_EVENT: a message has been received from another application.
* @GDK_VISIBILITY_NOTIFY: the window visibility status has changed.
* @GDK_SCROLL: the scroll wheel was turned * @GDK_SCROLL: the scroll wheel was turned
* @GDK_WINDOW_STATE: the state of a window has changed. See #GdkWindowState * @GDK_WINDOW_STATE: the state of a window has changed. See #GdkWindowState
* for the possible window states * for the possible window states
@ -320,7 +318,6 @@ typedef enum
GDK_DROP_START = 26, GDK_DROP_START = 26,
GDK_DROP_FINISHED = 27, GDK_DROP_FINISHED = 27,
GDK_CLIENT_EVENT = 28, GDK_CLIENT_EVENT = 28,
GDK_VISIBILITY_NOTIFY = 29,
GDK_SCROLL = 31, GDK_SCROLL = 31,
GDK_WINDOW_STATE = 32, GDK_WINDOW_STATE = 32,
GDK_OWNER_CHANGE = 34, GDK_OWNER_CHANGE = 34,
@ -340,21 +337,6 @@ typedef enum
GDK_EVENT_LAST /* helper variable for decls */ GDK_EVENT_LAST /* helper variable for decls */
} GdkEventType; } GdkEventType;
/**
* GdkVisibilityState:
* @GDK_VISIBILITY_UNOBSCURED: the window is completely visible.
* @GDK_VISIBILITY_PARTIAL: the window is partially visible.
* @GDK_VISIBILITY_FULLY_OBSCURED: the window is not visible at all.
*
* Specifies the visiblity status of a window for a #GdkEventVisibility.
*/
typedef enum
{
GDK_VISIBILITY_UNOBSCURED,
GDK_VISIBILITY_PARTIAL,
GDK_VISIBILITY_FULLY_OBSCURED
} GdkVisibilityState;
/** /**
* GdkTouchpadGesturePhase: * GdkTouchpadGesturePhase:
* @GDK_TOUCHPAD_GESTURE_PHASE_BEGIN: The gesture has begun. * @GDK_TOUCHPAD_GESTURE_PHASE_BEGIN: The gesture has begun.

View File

@ -72,29 +72,6 @@ struct _GdkEventExpose
gint count; /* If non-zero, how many more events follow. */ gint count; /* If non-zero, how many more events follow. */
}; };
/**
* GdkEventVisibility:
* @type: the type of the event (%GDK_VISIBILITY_NOTIFY).
* @window: the window which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @state: the new visibility state (%GDK_VISIBILITY_FULLY_OBSCURED,
* %GDK_VISIBILITY_PARTIAL or %GDK_VISIBILITY_UNOBSCURED).
*
* Generated when the window visibility status has changed.
*
* Deprecated: 3.12: Modern composited windowing systems with pervasive
* transparency make it impossible to track the visibility of a window
* reliably, so this event can not be guaranteed to provide useful
* information.
*/
struct _GdkEventVisibility
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
GdkVisibilityState state;
};
/** /**
* GdkEventMotion: * GdkEventMotion:
* @type: the type of the event. * @type: the type of the event.
@ -753,7 +730,6 @@ struct _GdkEventPadGroupMode {
* @type: the #GdkEventType * @type: the #GdkEventType
* @any: a #GdkEventAny * @any: a #GdkEventAny
* @expose: a #GdkEventExpose * @expose: a #GdkEventExpose
* @visibility: a #GdkEventVisibility
* @motion: a #GdkEventMotion * @motion: a #GdkEventMotion
* @button: a #GdkEventButton * @button: a #GdkEventButton
* @touch: a #GdkEventTouch * @touch: a #GdkEventTouch
@ -811,7 +787,6 @@ union _GdkEvent
GdkEventType type; GdkEventType type;
GdkEventAny any; GdkEventAny any;
GdkEventExpose expose; GdkEventExpose expose;
GdkEventVisibility visibility;
GdkEventMotion motion; GdkEventMotion motion;
GdkEventButton button; GdkEventButton button;
GdkEventTouch touch; GdkEventTouch touch;

View File

@ -386,7 +386,6 @@ typedef enum
* @GDK_FOCUS_CHANGE_MASK: receive focus change events * @GDK_FOCUS_CHANGE_MASK: receive focus change events
* @GDK_STRUCTURE_MASK: receive events about window configuration change * @GDK_STRUCTURE_MASK: receive events about window configuration change
* @GDK_PROPERTY_CHANGE_MASK: receive property change events * @GDK_PROPERTY_CHANGE_MASK: receive property change events
* @GDK_VISIBILITY_NOTIFY_MASK: receive visibility change events
* @GDK_PROXIMITY_IN_MASK: receive proximity in events * @GDK_PROXIMITY_IN_MASK: receive proximity in events
* @GDK_PROXIMITY_OUT_MASK: receive proximity out events * @GDK_PROXIMITY_OUT_MASK: receive proximity out events
* @GDK_SUBSTRUCTURE_MASK: receive events about window configuration changes of * @GDK_SUBSTRUCTURE_MASK: receive events about window configuration changes of
@ -434,7 +433,6 @@ typedef enum
GDK_FOCUS_CHANGE_MASK = 1 << 14, GDK_FOCUS_CHANGE_MASK = 1 << 14,
GDK_STRUCTURE_MASK = 1 << 15, GDK_STRUCTURE_MASK = 1 << 15,
GDK_PROPERTY_CHANGE_MASK = 1 << 16, GDK_PROPERTY_CHANGE_MASK = 1 << 16,
GDK_VISIBILITY_NOTIFY_MASK = 1 << 17,
GDK_PROXIMITY_IN_MASK = 1 << 18, GDK_PROXIMITY_IN_MASK = 1 << 18,
GDK_PROXIMITY_OUT_MASK = 1 << 19, GDK_PROXIMITY_OUT_MASK = 1 << 19,
GDK_SUBSTRUCTURE_MASK = 1 << 20, GDK_SUBSTRUCTURE_MASK = 1 << 20,

View File

@ -232,11 +232,6 @@ gdk_window_init (GdkWindow *window)
window->width = 1; window->width = 1;
window->height = 1; window->height = 1;
window->toplevel_window_type = -1; window->toplevel_window_type = -1;
/* starts hidden */
window->effective_visibility = GDK_VISIBILITY_NOT_VIEWABLE;
window->visibility = GDK_VISIBILITY_FULLY_OBSCURED;
/* Default to unobscured since some backends don't send visibility events */
window->native_visibility = GDK_VISIBILITY_UNOBSCURED;
window->children_list_node.data = window; window->children_list_node.data = window;
window->device_cursor = g_hash_table_new_full (NULL, NULL, window->device_cursor = g_hash_table_new_full (NULL, NULL,
@ -607,64 +602,6 @@ remove_child_area (GdkWindow *window,
} }
} }
static GdkVisibilityState
effective_visibility (GdkWindow *window)
{
GdkVisibilityState native;
if (!gdk_window_is_viewable (window))
return GDK_VISIBILITY_NOT_VIEWABLE;
native = window->impl_window->native_visibility;
if (native == GDK_VISIBILITY_FULLY_OBSCURED ||
window->visibility == GDK_VISIBILITY_FULLY_OBSCURED)
return GDK_VISIBILITY_FULLY_OBSCURED;
else if (native == GDK_VISIBILITY_UNOBSCURED)
return window->visibility;
else /* native PARTIAL, private partial or unobscured */
return GDK_VISIBILITY_PARTIAL;
}
static void
gdk_window_update_visibility (GdkWindow *window)
{
GdkVisibilityState new_visibility;
GdkEvent *event;
new_visibility = effective_visibility (window);
if (new_visibility != window->effective_visibility)
{
window->effective_visibility = new_visibility;
if (new_visibility != GDK_VISIBILITY_NOT_VIEWABLE &&
window->event_mask & GDK_VISIBILITY_NOTIFY_MASK)
{
event = _gdk_make_event (window, GDK_VISIBILITY_NOTIFY,
NULL, FALSE);
event->visibility.state = new_visibility;
}
}
}
static void
gdk_window_update_visibility_recursively (GdkWindow *window,
GdkWindow *only_for_impl)
{
GdkWindow *child;
GList *l;
gdk_window_update_visibility (window);
for (l = window->children; l != NULL; l = l->next)
{
child = l->data;
if ((only_for_impl == NULL) ||
(only_for_impl == child->impl_window))
gdk_window_update_visibility_recursively (child, only_for_impl);
}
}
static gboolean static gboolean
should_apply_clip_as_shape (GdkWindow *window) should_apply_clip_as_shape (GdkWindow *window)
{ {
@ -814,42 +751,6 @@ recompute_visible_regions_internal (GdkWindow *private,
private->clip_region = new_clip; private->clip_region = new_clip;
} }
if (clip_region_changed)
{
GdkVisibilityState visibility;
gboolean fully_visible;
if (cairo_region_is_empty (private->clip_region))
visibility = GDK_VISIBILITY_FULLY_OBSCURED;
else
{
if (private->shape)
{
fully_visible = cairo_region_equal (private->clip_region,
private->shape);
}
else
{
r.x = 0;
r.y = 0;
r.width = private->width;
r.height = private->height;
fully_visible = region_rect_equal (private->clip_region, &r);
}
if (fully_visible)
visibility = GDK_VISIBILITY_UNOBSCURED;
else
visibility = GDK_VISIBILITY_PARTIAL;
}
if (private->visibility != visibility)
{
private->visibility = visibility;
gdk_window_update_visibility (private);
}
}
/* Update all children, recursively (except for root, where children are not exact). */ /* Update all children, recursively (except for root, where children are not exact). */
if ((abs_pos_changed || clip_region_changed || recalculate_children) && if ((abs_pos_changed || clip_region_changed || recalculate_children) &&
private->window_type != GDK_WINDOW_ROOT) private->window_type != GDK_WINDOW_ROOT)
@ -953,7 +854,6 @@ get_native_device_event_mask (GdkWindow *private,
emulate events on children: */ emulate events on children: */
mask |= mask |=
GDK_EXPOSURE_MASK | GDK_EXPOSURE_MASK |
GDK_VISIBILITY_NOTIFY_MASK |
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
GDK_TOUCH_MASK | GDK_TOUCH_MASK |
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_MASK |
@ -3501,9 +3401,6 @@ gdk_window_show_internal (GdkWindow *window, gboolean raise)
{ {
recompute_visible_regions (window, FALSE); recompute_visible_regions (window, FALSE);
/* If any decendants became visible we need to send visibility notify */
gdk_window_update_visibility_recursively (window, NULL);
if (gdk_window_is_viewable (window)) if (gdk_window_is_viewable (window))
gdk_window_invalidate_rect_full (window, NULL, TRUE); gdk_window_invalidate_rect_full (window, NULL, TRUE);
} }
@ -3802,9 +3699,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
gdk_window_clear_old_updated_area (window); gdk_window_clear_old_updated_area (window);
recompute_visible_regions (window, FALSE); recompute_visible_regions (window, FALSE);
/* all decendants became non-visible, we need to send visibility notify */
gdk_window_update_visibility_recursively (window, NULL);
if (was_mapped && !gdk_window_has_impl (window)) if (was_mapped && !gdk_window_has_impl (window))
{ {
if (window->event_mask & GDK_STRUCTURE_MASK) if (window->event_mask & GDK_STRUCTURE_MASK)
@ -5645,7 +5539,6 @@ _gdk_make_event (GdkWindow *window,
case GDK_MAP: case GDK_MAP:
case GDK_UNMAP: case GDK_UNMAP:
case GDK_CLIENT_EVENT: case GDK_CLIENT_EVENT:
case GDK_VISIBILITY_NOTIFY:
case GDK_DELETE: case GDK_DELETE:
case GDK_DESTROY: case GDK_DESTROY:
case GDK_EXPOSE: case GDK_EXPOSE:
@ -5968,13 +5861,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
} }
#endif #endif
if (event->type == GDK_VISIBILITY_NOTIFY)
{
event_window->native_visibility = event->visibility.state;
gdk_window_update_visibility_recursively (event_window, event_window);
goto out;
}
if (event_window->window_type == GDK_WINDOW_ROOT) if (event_window->window_type == GDK_WINDOW_ROOT)
goto out; goto out;

View File

@ -789,32 +789,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
break; break;
} }
#endif /* G_ENABLE_DEBUG */ #endif /* G_ENABLE_DEBUG */
/* not handled */
if (window == NULL) return_val = FALSE;
{
return_val = FALSE;
break;
}
event->visibility.type = GDK_VISIBILITY_NOTIFY;
event->visibility.window = window;
switch (xevent->xvisibility.state)
{
case VisibilityFullyObscured:
event->visibility.state = GDK_VISIBILITY_FULLY_OBSCURED;
break;
case VisibilityPartiallyObscured:
event->visibility.state = GDK_VISIBILITY_PARTIAL;
break;
default:
case VisibilityUnobscured:
event->visibility.state = GDK_VISIBILITY_UNOBSCURED;
break;
}
break; break;
case CreateNotify: case CreateNotify:

View File

@ -74,9 +74,6 @@ struct _GtkLayoutPrivate
guint vscroll_policy : 1; guint vscroll_policy : 1;
/* Properties */ /* Properties */
GdkVisibilityState visibility;
GList *children; GList *children;
gint scroll_x; gint scroll_x;
@ -719,7 +716,6 @@ gtk_layout_init (GtkLayout *layout)
priv->scroll_x = 0; priv->scroll_x = 0;
priv->scroll_y = 0; priv->scroll_y = 0;
priv->visibility = GDK_VISIBILITY_PARTIAL;
priv->freeze_count = 0; priv->freeze_count = 0;
} }

View File

@ -1762,7 +1762,6 @@ gtk_main_do_event (GdkEvent *event)
case GDK_SELECTION_REQUEST: case GDK_SELECTION_REQUEST:
case GDK_SELECTION_NOTIFY: case GDK_SELECTION_NOTIFY:
case GDK_CLIENT_EVENT: case GDK_CLIENT_EVENT:
case GDK_VISIBILITY_NOTIFY:
case GDK_WINDOW_STATE: case GDK_WINDOW_STATE:
case GDK_GRAB_BROKEN: case GDK_GRAB_BROKEN:
case GDK_DAMAGE: case GDK_DAMAGE:

View File

@ -9745,7 +9745,7 @@ text_window_realize (GtkTextWindow *win,
window = gtk_widget_get_window (widget); window = gtk_widget_get_window (widget);
win->window = gdk_window_new_child (window, win->window = gdk_window_new_child (window,
GDK_VISIBILITY_NOTIFY_MASK, 0,
&win->allocation); &win->allocation);
gtk_widget_register_window (win->widget, win->window); gtk_widget_register_window (win->widget, win->window);

View File

@ -3701,7 +3701,7 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
width = drag_allocation.width; width = drag_allocation.width;
height = drag_allocation.height; height = drag_allocation.height;
tree_view->priv->drag_highlight_window = gdk_window_new_child (gtk_widget_get_window (widget), tree_view->priv->drag_highlight_window = gdk_window_new_child (gtk_widget_get_window (widget),
GDK_VISIBILITY_NOTIFY_MASK | GDK_POINTER_MOTION_MASK, GDK_POINTER_MOTION_MASK,
&(GdkRectangle){ &(GdkRectangle){
tree_view->priv->drag_column_x, tree_view->priv->drag_column_x,
0, 0,
@ -3751,7 +3751,7 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
} }
tree_view->priv->drag_highlight_window = gdk_window_new_popup (gtk_widget_get_display (widget), tree_view->priv->drag_highlight_window = gdk_window_new_popup (gtk_widget_get_display (widget),
GDK_VISIBILITY_NOTIFY_MASK | GDK_POINTER_MOTION_MASK, GDK_POINTER_MOTION_MASK,
&(GdkRectangle) { x, y, width, height }); &(GdkRectangle) { x, y, width, height });
gtk_widget_register_window (GTK_WIDGET (tree_view), tree_view->priv->drag_highlight_window); gtk_widget_register_window (GTK_WIDGET (tree_view), tree_view->priv->drag_highlight_window);
@ -3822,7 +3822,7 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
} }
tree_view->priv->drag_highlight_window = gdk_window_new_popup (gtk_widget_get_display (widget), tree_view->priv->drag_highlight_window = gdk_window_new_popup (gtk_widget_get_display (widget),
GDK_VISIBILITY_NOTIFY_MASK | GDK_POINTER_MOTION_MASK, GDK_POINTER_MOTION_MASK,
&(GdkRectangle) { x, y, width, height }); &(GdkRectangle) { x, y, width, height });
gtk_widget_register_window (GTK_WIDGET (tree_view), tree_view->priv->drag_highlight_window); gtk_widget_register_window (GTK_WIDGET (tree_view), tree_view->priv->drag_highlight_window);
@ -9680,7 +9680,7 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
button_allocation.y = 0; button_allocation.y = 0;
tree_view->priv->drag_window = gdk_window_new_child (gtk_widget_get_window (GTK_WIDGET (tree_view)), tree_view->priv->drag_window = gdk_window_new_child (gtk_widget_get_window (GTK_WIDGET (tree_view)),
GDK_VISIBILITY_NOTIFY_MASK | GDK_POINTER_MOTION_MASK, GDK_POINTER_MOTION_MASK,
&button_allocation); &button_allocation);
gtk_widget_register_window (GTK_WIDGET (tree_view), tree_view->priv->drag_window); gtk_widget_register_window (GTK_WIDGET (tree_view), tree_view->priv->drag_window);

View File

@ -6749,7 +6749,6 @@ gtk_widget_event_internal (GtkWidget *widget,
/* Non input events get handled right away */ /* Non input events get handled right away */
switch ((guint) event->type) switch ((guint) event->type)
{ {
case GDK_VISIBILITY_NOTIFY:
case GDK_EXPOSE: case GDK_EXPOSE:
case GDK_NOTHING: case GDK_NOTHING:
case GDK_DELETE: case GDK_DELETE:
@ -6823,7 +6822,6 @@ gtk_widget_emit_event_signals (GtkWidget *widget,
case GDK_PAD_RING: case GDK_PAD_RING:
case GDK_PAD_STRIP: case GDK_PAD_STRIP:
case GDK_PAD_GROUP_MODE: case GDK_PAD_GROUP_MODE:
case GDK_VISIBILITY_NOTIFY:
case GDK_EXPOSE: case GDK_EXPOSE:
case GDK_NOTHING: case GDK_NOTHING:
signal_num = -1; signal_num = -1;