forked from AuroraMiddleware/gtk
gdk: Replace all GDK_CONFIGURE usage with GdkSurface::layout
This removes the GDK_CONFIGURE event and all related functions and data types; it includes untested changes to the MacOSX, Win32 and Broadway backends.
This commit is contained in:
parent
3f96d4b6da
commit
42679f2903
@ -528,7 +528,6 @@ GDK_IS_EVENT
|
||||
gdk_event_get_type
|
||||
gdk_event_sequence_get_type
|
||||
gdk_button_event_get_type
|
||||
gdk_configure_event_get_type
|
||||
gdk_crossing_event_get_type
|
||||
gdk_delete_event_get_type
|
||||
gdk_dnd_event_get_type
|
||||
|
@ -280,12 +280,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->configure_notify.id));
|
||||
if (surface)
|
||||
{
|
||||
event = gdk_configure_event_new (surface,
|
||||
message->configure_notify.width,
|
||||
message->configure_notify.height);
|
||||
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
_gdk_windowing_got_event (display, node, event, message->base.serial);
|
||||
gdk_surface_request_layout (surface);
|
||||
|
||||
if (surface->resize_count >= 1)
|
||||
{
|
||||
|
@ -430,7 +430,6 @@ static void
|
||||
gdk_event_init_types_once (void)
|
||||
{
|
||||
g_type_ensure (GDK_TYPE_BUTTON_EVENT);
|
||||
g_type_ensure (GDK_TYPE_CONFIGURE_EVENT);
|
||||
g_type_ensure (GDK_TYPE_CROSSING_EVENT);
|
||||
g_type_ensure (GDK_TYPE_DELETE_EVENT);
|
||||
g_type_ensure (GDK_TYPE_DND_EVENT);
|
||||
@ -1818,76 +1817,6 @@ gdk_key_event_get_match (GdkEvent *event,
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ GdkConfigureEvent */
|
||||
|
||||
static gboolean
|
||||
gdk_configure_event_get_position (GdkEvent *event,
|
||||
double *x,
|
||||
double *y)
|
||||
{
|
||||
GdkConfigureEvent *self = (GdkConfigureEvent *) event;
|
||||
|
||||
*x = self->x;
|
||||
*y = self->y;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const GdkEventTypeInfo gdk_configure_event_info = {
|
||||
sizeof (GdkConfigureEvent),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
gdk_configure_event_get_position,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
GDK_DEFINE_EVENT_TYPE (GdkConfigureEvent, gdk_configure_event,
|
||||
&gdk_configure_event_info,
|
||||
GDK_EVENT_TYPE_SLOT (GDK_CONFIGURE))
|
||||
|
||||
GdkEvent *
|
||||
gdk_configure_event_new (GdkSurface *surface,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
GdkConfigureEvent *self;
|
||||
|
||||
g_return_val_if_fail (width >= 0 && height >= 0, NULL);
|
||||
|
||||
self = gdk_event_alloc (GDK_CONFIGURE, surface, NULL, GDK_CURRENT_TIME);
|
||||
self->width = width;
|
||||
self->height = height;
|
||||
|
||||
return (GdkEvent *) self;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_configure_event_get_size:
|
||||
* @event: (type GdkConfigureEvent): a configure event
|
||||
* @width: (out): return location for surface width
|
||||
* @height: (out): return location for surface height
|
||||
*
|
||||
* Extracts the surface size from a configure event.
|
||||
*/
|
||||
void
|
||||
gdk_configure_event_get_size (GdkEvent *event,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
GdkConfigureEvent *self = (GdkConfigureEvent *) event;
|
||||
|
||||
g_return_if_fail (GDK_IS_EVENT (event));
|
||||
g_return_if_fail (GDK_IS_EVENT_TYPE (event, GDK_CONFIGURE));
|
||||
|
||||
*width = self->width;
|
||||
*height = self->height;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ GdkTouchEvent */
|
||||
|
||||
static void
|
||||
|
@ -106,7 +106,6 @@ typedef struct _GdkEventSequence GdkEventSequence;
|
||||
typedef struct _GdkEvent GdkEvent;
|
||||
|
||||
#define GDK_TYPE_BUTTON_EVENT (gdk_button_event_get_type())
|
||||
#define GDK_TYPE_CONFIGURE_EVENT (gdk_configure_event_get_type())
|
||||
#define GDK_TYPE_CROSSING_EVENT (gdk_crossing_event_get_type())
|
||||
#define GDK_TYPE_DELETE_EVENT (gdk_delete_event_get_type())
|
||||
#define GDK_TYPE_DND_EVENT (gdk_dnd_event_get_type())
|
||||
@ -121,7 +120,6 @@ typedef struct _GdkEvent GdkEvent;
|
||||
#define GDK_TYPE_TOUCHPAD_EVENT (gdk_touchpad_event_get_type())
|
||||
|
||||
typedef struct _GdkButtonEvent GdkButtonEvent;
|
||||
typedef struct _GdkConfigureEvent GdkConfigureEvent;
|
||||
typedef struct _GdkCrossingEvent GdkCrossingEvent;
|
||||
typedef struct _GdkDeleteEvent GdkDeleteEvent;
|
||||
typedef struct _GdkDNDEvent GdkDNDEvent;
|
||||
@ -148,7 +146,6 @@ typedef struct _GdkTouchpadEvent GdkTouchpadEvent;
|
||||
* @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 of the surface has changed.
|
||||
* @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
|
||||
@ -188,7 +185,6 @@ typedef enum
|
||||
GDK_ENTER_NOTIFY,
|
||||
GDK_LEAVE_NOTIFY,
|
||||
GDK_FOCUS_CHANGE,
|
||||
GDK_CONFIGURE,
|
||||
GDK_PROXIMITY_IN,
|
||||
GDK_PROXIMITY_OUT,
|
||||
GDK_DRAG_ENTER,
|
||||
@ -429,12 +425,6 @@ GdkNotifyType gdk_crossing_event_get_detail (GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_crossing_event_get_focus (GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_configure_event_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_configure_event_get_size (GdkEvent *event,
|
||||
int *width,
|
||||
int *height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_touchpad_event_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkTouchpadGesturePhase
|
||||
|
@ -322,25 +322,6 @@ struct _GdkFocusEvent
|
||||
gboolean focus_in;
|
||||
};
|
||||
|
||||
/*
|
||||
* GdkConfigureEvent:
|
||||
* @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 _GdkConfigureEvent
|
||||
{
|
||||
GdkEvent parent_instance;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
/*
|
||||
* GdkProximityEvent:
|
||||
* @tool: the #GdkDeviceTool associated to the event
|
||||
|
@ -2830,14 +2830,6 @@ add_event_mark (GdkEvent *event,
|
||||
break;
|
||||
}
|
||||
|
||||
case GDK_CONFIGURE:
|
||||
{
|
||||
int width, height;
|
||||
gdk_configure_event_get_size (event, &width, &height);
|
||||
message = g_strdup_printf ("%s {width=%d, height=%d}", kind, width, height);
|
||||
break;
|
||||
}
|
||||
|
||||
case GDK_ENTER_NOTIFY:
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
case GDK_TOUCHPAD_SWIPE:
|
||||
@ -2875,30 +2867,18 @@ add_event_mark (GdkEvent *event,
|
||||
gboolean
|
||||
gdk_surface_handle_event (GdkEvent *event)
|
||||
{
|
||||
GdkSurface *surface = gdk_event_get_surface (event);
|
||||
gint64 begin_time = GDK_PROFILER_CURRENT_TIME;
|
||||
gboolean handled = FALSE;
|
||||
|
||||
if (check_autohide (event))
|
||||
return TRUE;
|
||||
|
||||
if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
gdk_configure_event_get_size (event, &width, &height);
|
||||
gdk_surface_emit_size_changed (gdk_event_get_surface (event),
|
||||
width, height);
|
||||
handled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkSurface *surface = gdk_event_get_surface (event);
|
||||
if (gdk_event_get_event_type (event) == GDK_MOTION_NOTIFY)
|
||||
surface->request_motion = FALSE;
|
||||
|
||||
if (gdk_event_get_event_type (event) == GDK_MOTION_NOTIFY)
|
||||
surface->request_motion = FALSE;
|
||||
|
||||
g_signal_emit (surface, signals[EVENT], 0, event, &handled);
|
||||
}
|
||||
g_signal_emit (surface, signals[EVENT], 0, event, &handled);
|
||||
|
||||
if (GDK_PROFILER_IS_RUNNING)
|
||||
add_event_mark (event, begin_time, GDK_PROFILER_CURRENT_TIME);
|
||||
|
@ -256,13 +256,7 @@
|
||||
|
||||
_gdk_surface_update_size (surface);
|
||||
|
||||
/* Synthesize a configure event */
|
||||
event = gdk_configure_event_new (surface,
|
||||
content_rect.size.width,
|
||||
content_rect.size.height);
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
_gdk_windowing_got_event (display, node, event,
|
||||
_gdk_display_get_next_serial (display));
|
||||
gdk_surface_request_layout (surface);
|
||||
|
||||
_gdk_macos_surface_reposition_children (gdk_surface);
|
||||
|
||||
|
@ -1277,35 +1277,6 @@ _gdk_win32_get_window_rect (GdkSurface *window,
|
||||
return !impl->inhibit_configure;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_do_emit_configure_event (GdkSurface *surface,
|
||||
RECT rect)
|
||||
{
|
||||
GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
|
||||
|
||||
impl->unscaled_width = rect.right - rect.left;
|
||||
impl->unscaled_height = rect.bottom - rect.top;
|
||||
surface->width = (impl->unscaled_width + impl->surface_scale - 1) / impl->surface_scale;
|
||||
surface->height = (impl->unscaled_height + impl->surface_scale - 1) / impl->surface_scale;
|
||||
surface->x = rect.left / impl->surface_scale;
|
||||
surface->y = rect.top / impl->surface_scale;
|
||||
|
||||
_gdk_surface_update_size (surface);
|
||||
|
||||
g_signal_emit_by_name (surface, "size-changed", surface->width, surface->height);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_emit_configure_event (GdkSurface *surface)
|
||||
{
|
||||
RECT rect;
|
||||
|
||||
if (!_gdk_win32_get_window_rect (surface, &rect))
|
||||
return;
|
||||
|
||||
_gdk_win32_do_emit_configure_event (surface, rect);
|
||||
}
|
||||
|
||||
cairo_region_t *
|
||||
_gdk_win32_hrgn_to_region (HRGN hrgn,
|
||||
guint scale)
|
||||
@ -2889,7 +2860,7 @@ gdk_event_translate (MSG *msg,
|
||||
{
|
||||
if (!IsIconic (msg->hwnd) &&
|
||||
!GDK_SURFACE_DESTROYED (window))
|
||||
_gdk_win32_emit_configure_event (window);
|
||||
gdk_surface_request_layout (window);
|
||||
}
|
||||
|
||||
if ((windowpos->flags & SWP_HIDEWINDOW) &&
|
||||
|
@ -407,7 +407,6 @@ GdkSurface *gdk_win32_display_get_root_window (GdkDisplay *display);
|
||||
/* Distributed display manager implementation */
|
||||
GdkDisplay *_gdk_win32_display_open (const char *display_name);
|
||||
void _gdk_win32_append_event (GdkEvent *event);
|
||||
void _gdk_win32_emit_configure_event (GdkSurface *window);
|
||||
|
||||
|
||||
guint32 _gdk_win32_keymap_get_decimal_mark (GdkWin32Keymap *keymap);
|
||||
|
@ -1190,7 +1190,7 @@ gdk_win32_surface_move_resize_internal (GdkSurface *window,
|
||||
out:
|
||||
surface->inhibit_configure = FALSE;
|
||||
|
||||
_gdk_win32_emit_configure_event (window);
|
||||
gdk_surface_request_layout (window);
|
||||
}
|
||||
|
||||
void
|
||||
@ -4018,7 +4018,7 @@ gdk_win32_surface_do_move_resize_drag (GdkSurface *window,
|
||||
rect.bottom != new_rect.bottom))
|
||||
{
|
||||
context->native_move_resize_pending = TRUE;
|
||||
_gdk_win32_do_emit_configure_event (window, new_rect);
|
||||
gdk_surface_request_layout (window);
|
||||
}
|
||||
else if (context->op == GDK_WIN32_DRAGOP_MOVE &&
|
||||
(rect.left != new_rect.left ||
|
||||
@ -4026,7 +4026,7 @@ gdk_win32_surface_do_move_resize_drag (GdkSurface *window,
|
||||
{
|
||||
context->native_move_resize_pending = FALSE;
|
||||
|
||||
_gdk_win32_do_emit_configure_event (window, new_rect);
|
||||
gdk_surface_request_layout (window);
|
||||
|
||||
if (impl->layered)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user