gdk: Drop GdkEventWindowState

No longer generate this event. Instead, emit change
notification for GdkWindow::state.
This commit is contained in:
Matthias Clasen 2017-12-14 22:23:01 -05:00
parent a4a2ecb21a
commit 11a946df39
4 changed files with 1 additions and 105 deletions

View File

@ -723,7 +723,6 @@ GdkEventConfigure
GdkEventProperty
GdkEventDND
GdkEventProximity
GdkEventWindowState
GdkEventOwnerChange
GdkEventGrabBroken
GdkEventTouchpadSwipe

View File

@ -866,7 +866,6 @@ gdk_event_get_time (const GdkEvent *event)
case GDK_EXPOSE:
case GDK_MAP:
case GDK_UNMAP:
case GDK_WINDOW_STATE:
case GDK_GRAB_BROKEN:
case GDK_EVENT_LAST:
default:
@ -946,7 +945,6 @@ gdk_event_get_state (const GdkEvent *event,
case GDK_EXPOSE:
case GDK_MAP:
case GDK_UNMAP:
case GDK_WINDOW_STATE:
case GDK_GRAB_BROKEN:
case GDK_PAD_BUTTON_PRESS:
case GDK_PAD_BUTTON_RELEASE:
@ -1939,60 +1937,18 @@ gdk_get_show_events (void)
return (_gdk_debug_flags & GDK_DEBUG_EVENTS) != 0;
}
static GList *
gdk_get_pending_window_state_event_link (GdkWindow *window)
{
GdkDisplay *display = gdk_window_get_display (window);
GList *tmp_list;
for (tmp_list = display->queued_events; tmp_list; tmp_list = tmp_list->next)
{
GdkEvent *event = tmp_list->data;
if (event->any.type == GDK_WINDOW_STATE &&
event->any.window == window)
return tmp_list;
}
return NULL;
}
void
_gdk_set_window_state (GdkWindow *window,
GdkWindowState new_state)
{
GdkDisplay *display = gdk_window_get_display (window);
GdkEvent *temp_event;
GdkWindowState old;
GList *pending_event_link;
g_return_if_fail (window != NULL);
if (new_state == window->state)
return; /* No actual work to do, nothing changed. */
temp_event = gdk_event_new (GDK_WINDOW_STATE);
temp_event->any.window = g_object_ref (window);
temp_event->any.send_event = FALSE;
temp_event->window_state.new_window_state = new_state;
pending_event_link = gdk_get_pending_window_state_event_link (window);
if (pending_event_link)
{
old = window->old_state;
_gdk_event_queue_remove_link (display, pending_event_link);
gdk_event_free (pending_event_link->data);
g_list_free_1 (pending_event_link);
}
else
{
old = window->state;
window->old_state = old;
}
temp_event->window_state.changed_mask = new_state ^ old;
/* Actually update the field in GdkWindow, this is sort of an odd
* place to do it, but seems like the safest since it ensures we expose no
* inconsistent state to the user.
@ -2000,8 +1956,7 @@ _gdk_set_window_state (GdkWindow *window,
window->state = new_state;
if (temp_event->window_state.changed_mask & GDK_WINDOW_STATE_WITHDRAWN)
_gdk_window_update_viewable (window);
_gdk_window_update_viewable (window);
/* We only really send the event to toplevels, since
* all the window states don't apply to non-toplevels.
@ -2012,7 +1967,6 @@ _gdk_set_window_state (GdkWindow *window,
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_TEMP: /* ? */
gdk_display_put_event (display, temp_event);
g_object_notify (G_OBJECT (window), "state");
break;
case GDK_WINDOW_FOREIGN:
@ -2021,8 +1975,6 @@ _gdk_set_window_state (GdkWindow *window,
default:
break;
}
gdk_event_free (temp_event);
}
void
@ -2460,33 +2412,6 @@ gdk_event_get_grab_window (const GdkEvent *event,
return FALSE;
}
/**
* gdk_event_get_window_state:
* @event: a #GdkEvent
* @changed: (out):
* @new_state: (out):
*
* Returns: %TRUE on success, otherwise %FALSE
**/
gboolean
gdk_event_get_window_state (const GdkEvent *event,
GdkWindowState *changed,
GdkWindowState *new_state)
{
if (!event)
return FALSE;
if (event->any.type == GDK_WINDOW_STATE)
{
*changed = event->window_state.changed_mask;
*new_state = event->window_state.new_window_state;
return TRUE;
}
return FALSE;
}
/**
* gdk_event_get_focus_in:
* @event: a #GdkEvent

View File

@ -137,7 +137,6 @@ typedef struct _GdkEventCrossing GdkEventCrossing;
typedef struct _GdkEventConfigure GdkEventConfigure;
typedef struct _GdkEventProximity GdkEventProximity;
typedef struct _GdkEventDND GdkEventDND;
typedef struct _GdkEventWindowState GdkEventWindowState;
typedef struct _GdkEventSetting GdkEventSetting;
typedef struct _GdkEventGrabBroken GdkEventGrabBroken;
typedef struct _GdkEventTouchpadSwipe GdkEventTouchpadSwipe;
@ -246,8 +245,6 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
* @GDK_DROP_FINISHED: the drop operation initiated by the window has completed.
* @GDK_CLIENT_EVENT: a message has been received from another application.
* @GDK_SCROLL: the scroll wheel was turned
* @GDK_WINDOW_STATE: the state of a window has changed. See #GdkWindowState
* for the possible window states
* @GDK_GRAB_BROKEN: a pointer or keyboard grab was broken. This event type
* was added in 2.8.
* @GDK_DAMAGE: the content of the window has been changed. This event type
@ -309,7 +306,6 @@ typedef enum
GDK_DROP_FINISHED = 27,
GDK_CLIENT_EVENT = 28,
GDK_SCROLL = 31,
GDK_WINDOW_STATE = 32,
GDK_GRAB_BROKEN = 35,
GDK_DAMAGE = 36,
GDK_TOUCH_BEGIN = 37,
@ -674,10 +670,6 @@ GDK_AVAILABLE_IN_3_92
gboolean gdk_event_get_grab_window (const GdkEvent *event,
GdkWindow **window);
GDK_AVAILABLE_IN_3_92
gboolean gdk_event_get_window_state (const GdkEvent *event,
GdkWindowState *changed,
GdkWindowState *new_state);
GDK_AVAILABLE_IN_3_92
gboolean gdk_event_get_focus_in (const GdkEvent *event,
gboolean *focus_in);
GDK_AVAILABLE_IN_3_92

View File

@ -405,24 +405,6 @@ struct _GdkEventProximity
guint32 time;
};
/**
* GdkEventWindowState:
* @type: the type of the event (%GDK_WINDOW_STATE).
* @window: the window which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @changed_mask: mask specifying what flags have changed.
* @new_window_state: the new window state, a combination of
* #GdkWindowState bits.
*
* Generated when the state of a toplevel window changes.
*/
struct _GdkEventWindowState
{
GdkEventAny any;
GdkWindowState changed_mask;
GdkWindowState new_window_state;
};
/**
* GdkEventGrabBroken:
* @type: the type of the event (%GDK_GRAB_BROKEN)
@ -640,7 +622,6 @@ struct _GdkEventPadGroupMode {
* @configure: a #GdkEventConfigure
* @proximity: a #GdkEventProximity
* @dnd: a #GdkEventDND
* @window_state: a #GdkEventWindowState
* @grab_broken: a #GdkEventGrabBroken
* @touchpad_swipe: a #GdkEventTouchpadSwipe
* @touchpad_pinch: a #GdkEventTouchpadPinch
@ -693,7 +674,6 @@ union _GdkEvent
GdkEventConfigure configure;
GdkEventProximity proximity;
GdkEventDND dnd;
GdkEventWindowState window_state;
GdkEventGrabBroken grab_broken;
GdkEventTouchpadSwipe touchpad_swipe;
GdkEventTouchpadPinch touchpad_pinch;