forked from AuroraMiddleware/gtk
Merge branch 'wip/no-move-surface' into 'master'
Remove surface moving APIs See merge request GNOME/gtk!1016
This commit is contained in:
commit
88ab3a6942
@ -98,7 +98,9 @@ _gdk_broadway_display_size_changed (GdkDisplay *display,
|
||||
GdkBroadwaySurface *toplevel = l->data;
|
||||
|
||||
if (toplevel->maximized)
|
||||
gdk_surface_move_resize (GDK_SURFACE (toplevel), 0, 0, msg->width, msg->height);
|
||||
gdk_broadway_surface_move_resize (GDK_SURFACE (toplevel),
|
||||
0, 0,
|
||||
msg->width, msg->height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,12 @@ void _gdk_broadway_surface_grab_check_unmap (GdkSurface *surface,
|
||||
gulong serial);
|
||||
void gdk_broadway_surface_update_popups (GdkSurface *surface);
|
||||
|
||||
void gdk_broadway_surface_move_resize (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
void _gdk_keymap_keys_changed (GdkDisplay *display);
|
||||
gint _gdk_broadway_get_group_for_state (GdkDisplay *display,
|
||||
GdkModifierType state);
|
||||
|
@ -368,12 +368,12 @@ gdk_broadway_surface_withdraw (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_move_resize (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
gdk_broadway_surface_move_resize_internal (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
@ -424,6 +424,84 @@ gdk_broadway_surface_move_resize (GdkSurface *surface,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdk_broadway_surface_move_resize (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
gdk_broadway_surface_move_resize_internal (surface, TRUE,
|
||||
x, y,
|
||||
width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_toplevel_resize (GdkSurface *surface,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
gdk_broadway_surface_move_resize_internal (surface, FALSE,
|
||||
0, 0,
|
||||
width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_move (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
gdk_broadway_surface_move_resize_internal (surface, TRUE, x, y, -1, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_moved_to_rect (GdkSurface *surface,
|
||||
GdkRectangle final_rect)
|
||||
{
|
||||
GdkSurface *toplevel;
|
||||
int x, y;
|
||||
|
||||
if (surface->surface_type == GDK_SURFACE_POPUP)
|
||||
toplevel = surface->parent;
|
||||
else
|
||||
toplevel = surface->transient_for;
|
||||
|
||||
gdk_surface_get_origin (toplevel, &x, &y);
|
||||
x += final_rect.x;
|
||||
y += final_rect.y;
|
||||
|
||||
if (final_rect.width != surface->width ||
|
||||
final_rect.height != surface->height)
|
||||
{
|
||||
gdk_broadway_surface_move_resize (surface,
|
||||
x, y,
|
||||
final_rect.width, final_rect.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_broadway_surface_move (surface, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_move_to_rect (GdkSurface *surface,
|
||||
const GdkRectangle *rect,
|
||||
GdkGravity rect_anchor,
|
||||
GdkGravity surface_anchor,
|
||||
GdkAnchorHints anchor_hints,
|
||||
gint rect_anchor_dx,
|
||||
gint rect_anchor_dy)
|
||||
{
|
||||
gdk_surface_move_to_rect_helper (surface,
|
||||
rect,
|
||||
rect_anchor,
|
||||
surface_anchor,
|
||||
anchor_hints,
|
||||
rect_anchor_dx,
|
||||
rect_anchor_dy,
|
||||
gdk_broadway_surface_moved_to_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_raise (GdkSurface *surface)
|
||||
{
|
||||
@ -695,9 +773,9 @@ gdk_broadway_surface_maximize (GdkSurface *surface)
|
||||
monitor = gdk_display_get_primary_monitor (display);
|
||||
gdk_monitor_get_geometry (monitor, &geom);
|
||||
|
||||
gdk_surface_move_resize (surface,
|
||||
geom.x, geom.y,
|
||||
geom.width, geom.height);
|
||||
gdk_broadway_surface_move_resize (surface,
|
||||
geom.x, geom.y,
|
||||
geom.width, geom.height);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -718,11 +796,11 @@ gdk_broadway_surface_unmaximize (GdkSurface *surface)
|
||||
|
||||
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_MAXIMIZED, 0);
|
||||
|
||||
gdk_surface_move_resize (surface,
|
||||
impl->pre_maximize_x,
|
||||
impl->pre_maximize_y,
|
||||
impl->pre_maximize_width,
|
||||
impl->pre_maximize_height);
|
||||
gdk_broadway_surface_move_resize (surface,
|
||||
impl->pre_maximize_x,
|
||||
impl->pre_maximize_y,
|
||||
impl->pre_maximize_width,
|
||||
impl->pre_maximize_height);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -813,7 +891,9 @@ gdk_broadway_surface_update_popups (GdkSurface *parent)
|
||||
int new_y = parent->y + popup_impl->offset_y;
|
||||
|
||||
if (new_x != popup->x || new_y != popup->y)
|
||||
gdk_broadway_surface_move_resize (popup, TRUE, new_x, new_y, popup->width, popup->height);
|
||||
gdk_broadway_surface_move_resize (popup,
|
||||
new_x, new_y,
|
||||
popup->width, popup->height);
|
||||
gdk_broadway_surface_restack_toplevel (popup, parent, TRUE);
|
||||
}
|
||||
}
|
||||
@ -935,7 +1015,8 @@ update_pos (MoveResizeData *mv_resize,
|
||||
w, h, &w, &h);
|
||||
}
|
||||
|
||||
gdk_surface_move_resize (mv_resize->moveresize_surface, x, y, w, h);
|
||||
gdk_broadway_surface_move_resize (mv_resize->moveresize_surface,
|
||||
x, y, w, h);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -944,7 +1025,7 @@ update_pos (MoveResizeData *mv_resize,
|
||||
x = mv_resize->moveresize_orig_x + dx;
|
||||
y = mv_resize->moveresize_orig_y + dy;
|
||||
|
||||
gdk_surface_move (mv_resize->moveresize_surface, x, y);
|
||||
gdk_broadway_surface_move (mv_resize->moveresize_surface, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1311,7 +1392,8 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
|
||||
impl_class->raise = gdk_broadway_surface_raise;
|
||||
impl_class->lower = gdk_broadway_surface_lower;
|
||||
impl_class->restack_toplevel = gdk_broadway_surface_restack_toplevel;
|
||||
impl_class->move_resize = gdk_broadway_surface_move_resize;
|
||||
impl_class->toplevel_resize = gdk_broadway_surface_toplevel_resize;
|
||||
impl_class->move_to_rect = gdk_broadway_surface_move_to_rect;
|
||||
impl_class->get_geometry = gdk_broadway_surface_get_geometry;
|
||||
impl_class->get_root_coords = gdk_broadway_surface_get_root_coords;
|
||||
impl_class->get_device_state = gdk_broadway_surface_get_device_state;
|
||||
|
@ -264,16 +264,6 @@ void gdk_surface_get_geometry (GdkSurface *surface,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
void gdk_surface_move (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
void gdk_surface_move_resize (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
GdkGLContext *gdk_surface_get_shared_data_gl_context (GdkSurface *surface);
|
||||
|
||||
G_END_DECLS
|
||||
|
107
gdk/gdksurface.c
107
gdk/gdksurface.c
@ -246,14 +246,15 @@ maybe_flip_position (gint bounds_pos,
|
||||
return primary;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_real_move_to_rect (GdkSurface *surface,
|
||||
const GdkRectangle *rect,
|
||||
GdkGravity rect_anchor,
|
||||
GdkGravity surface_anchor,
|
||||
GdkAnchorHints anchor_hints,
|
||||
gint rect_anchor_dx,
|
||||
gint rect_anchor_dy)
|
||||
void
|
||||
gdk_surface_move_to_rect_helper (GdkSurface *surface,
|
||||
const GdkRectangle *rect,
|
||||
GdkGravity rect_anchor,
|
||||
GdkGravity surface_anchor,
|
||||
GdkAnchorHints anchor_hints,
|
||||
gint rect_anchor_dx,
|
||||
gint rect_anchor_dy,
|
||||
GdkSurfaceMovedToRect moved_to_rect)
|
||||
{
|
||||
GdkSurface *toplevel;
|
||||
GdkDisplay *display;
|
||||
@ -362,17 +363,14 @@ gdk_surface_real_move_to_rect (GdkSurface *surface,
|
||||
final_rect.width += surface->shadow_left + surface->shadow_right;
|
||||
final_rect.height += surface->shadow_top + surface->shadow_bottom;
|
||||
|
||||
if (final_rect.width != surface->width || final_rect.height != surface->height)
|
||||
gdk_surface_move_resize (surface, final_rect.x, final_rect.y, final_rect.width, final_rect.height);
|
||||
else
|
||||
gdk_surface_move (surface, final_rect.x, final_rect.y);
|
||||
|
||||
gdk_surface_get_origin (toplevel, &x, &y);
|
||||
final_rect.x -= x;
|
||||
final_rect.y -= y;
|
||||
flipped_rect.x -= x;
|
||||
flipped_rect.y -= y;
|
||||
|
||||
moved_to_rect (surface, final_rect);
|
||||
|
||||
g_signal_emit_by_name (surface,
|
||||
"moved-to-rect",
|
||||
&flipped_rect,
|
||||
@ -411,7 +409,6 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
object_class->get_property = gdk_surface_get_property;
|
||||
|
||||
klass->beep = gdk_surface_real_beep;
|
||||
klass->move_to_rect = gdk_surface_real_move_to_rect;
|
||||
|
||||
/**
|
||||
* GdkSurface:cursor:
|
||||
@ -2072,59 +2069,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
GDK_SURFACE_GET_CLASS (surface)->hide (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_move_resize_toplevel (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GDK_SURFACE_GET_CLASS (surface)->move_resize (surface, with_move, x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gdk_surface_move_resize_internal (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
|
||||
if (surface->destroyed)
|
||||
return;
|
||||
|
||||
gdk_surface_move_resize_toplevel (surface, with_move, x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* gdk_surface_move:
|
||||
* @surface: a #GdkSurface
|
||||
* @x: X coordinate relative to surface’s parent
|
||||
* @y: Y coordinate relative to surface’s parent
|
||||
*
|
||||
* Repositions a surface relative to its parent surface.
|
||||
* For toplevel surfaces, window managers may ignore or modify the move;
|
||||
* you should probably use gtk_window_move() on a #GtkWindow widget
|
||||
* anyway, instead of using GDK functions. For child surfaces,
|
||||
* the move will reliably succeed.
|
||||
*
|
||||
* If you’re also planning to resize the surface, use gdk_surface_move_resize()
|
||||
* to both move and resize simultaneously, for a nicer visual effect.
|
||||
**/
|
||||
void
|
||||
gdk_surface_move (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
gdk_surface_move_resize_internal (surface, TRUE, x, y, -1, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_resize:
|
||||
* @surface: a #GdkSurface
|
||||
@ -2142,31 +2086,7 @@ gdk_surface_resize (GdkSurface *surface,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
gdk_surface_move_resize_internal (surface, FALSE, 0, 0, width, height);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gdk_surface_move_resize:
|
||||
* @surface: a #GdkSurface
|
||||
* @x: new X position relative to surface’s parent
|
||||
* @y: new Y position relative to surface’s parent
|
||||
* @width: new width
|
||||
* @height: new height
|
||||
*
|
||||
* Equivalent to calling gdk_surface_move() and gdk_surface_resize(),
|
||||
* except that both operations are performed at once, avoiding strange
|
||||
* visual effects. (i.e. the user may be able to see the surface first
|
||||
* move, then resize, if you don’t use gdk_surface_move_resize().)
|
||||
**/
|
||||
void
|
||||
gdk_surface_move_resize (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
gdk_surface_move_resize_internal (surface, TRUE, x, y, width, height);
|
||||
GDK_SURFACE_GET_CLASS (surface)->toplevel_resize (surface, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2963,8 +2883,7 @@ gdk_surface_set_modal_hint (GdkSurface *surface,
|
||||
* this is to constrain user resizing, but the windowing system
|
||||
* will typically (but is not required to) also constrain the
|
||||
* current size of the surface to the provided values and
|
||||
* constrain programatic resizing via gdk_surface_resize() or
|
||||
* gdk_surface_move_resize().
|
||||
* constrain programatic resizing via gdk_surface_resize().
|
||||
*
|
||||
* Note that on X11, this effect has no effect on surfaces
|
||||
* of type %GDK_SURFACE_TEMP since these surfaces are not resizable
|
||||
|
@ -113,10 +113,7 @@ struct _GdkSurfaceClass
|
||||
GdkSurface *sibling,
|
||||
gboolean above);
|
||||
|
||||
void (* move_resize) (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
gint x,
|
||||
gint y,
|
||||
void (* toplevel_resize) (GdkSurface *surface,
|
||||
gint width,
|
||||
gint height);
|
||||
void (* move_to_rect) (GdkSurface *surface,
|
||||
@ -258,6 +255,19 @@ struct _GdkSurfaceClass
|
||||
void gdk_surface_set_state (GdkSurface *surface,
|
||||
GdkSurfaceState new_state);
|
||||
|
||||
typedef void (* GdkSurfaceMovedToRect) (GdkSurface *surface,
|
||||
GdkRectangle final_rect);
|
||||
|
||||
void
|
||||
gdk_surface_move_to_rect_helper (GdkSurface *surface,
|
||||
const GdkRectangle *rect,
|
||||
GdkGravity rect_anchor,
|
||||
GdkGravity surface_anchor,
|
||||
GdkAnchorHints anchor_hints,
|
||||
gint rect_anchor_dx,
|
||||
gint rect_anchor_dy,
|
||||
GdkSurfaceMovedToRect moved_to_rect);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_SURFACE_PRIVATE_H__ */
|
||||
|
@ -1237,24 +1237,61 @@ window_quartz_move_resize (GdkSurface *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_quartz_move_resize (GdkSurface *window,
|
||||
gboolean with_move,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
gdk_surface_quartz_toplevel_resize (GdkSurface *surface,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
if (with_move && (width < 0 && height < 0))
|
||||
window_quartz_move (window, x, y);
|
||||
window_quartz_resize (window, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_surface_moved_to_rect (GdkSurface *surface,
|
||||
GdkRectangle final_rect)
|
||||
{
|
||||
GdkSurface *toplevel;
|
||||
int x, y;
|
||||
|
||||
if (surface->surface_type == GDK_SURFACE_POPUP)
|
||||
toplevel = surface->parent;
|
||||
else
|
||||
toplevel = surface->transient_for;
|
||||
|
||||
gdk_surface_get_origin (toplevel, &x, &y);
|
||||
x += final_rect.x;
|
||||
y += final_rect.y;
|
||||
|
||||
if (final_rect.width != surface->width ||
|
||||
final_rect.height != surface->height)
|
||||
{
|
||||
window_quartz_move_resize (surface,
|
||||
x, y,
|
||||
final_rect.width, final_rect.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (with_move)
|
||||
window_quartz_move_resize (window, x, y, width, height);
|
||||
else
|
||||
window_quartz_resize (window, width, height);
|
||||
window_quartz_resize (surface, final_rect.width, final_rect.height);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_surface_move_to_rect (GdkSurface *surface,
|
||||
const GdkRectangle *rect,
|
||||
GdkGravity rect_anchor,
|
||||
GdkGravity surface_anchor,
|
||||
GdkAnchorHints anchor_hints,
|
||||
gint rect_anchor_dx,
|
||||
gint rect_anchor_dy)
|
||||
{
|
||||
gdk_surface_move_to_rect_helper (surface,
|
||||
rect,
|
||||
rect_anchor,
|
||||
surface_anchor,
|
||||
anchor_hints,
|
||||
rect_anchor_dx,
|
||||
rect_anchor_dy,
|
||||
gdk_quartz_surface_moved_to_rect);
|
||||
}
|
||||
|
||||
/* Get the toplevel ordering from NSApp and update our own list. We do
|
||||
* this on demand since the NSApp’s list is not up to date directly
|
||||
* after we get windowDidBecomeMain.
|
||||
@ -2641,7 +2678,8 @@ gdk_surface_impl_quartz_class_init (GdkSurfaceImplQuartzClass *klass)
|
||||
impl_class->raise = gdk_surface_quartz_raise;
|
||||
impl_class->lower = gdk_surface_quartz_lower;
|
||||
impl_class->restack_toplevel = gdk_surface_quartz_restack_toplevel;
|
||||
impl_class->move_resize = gdk_surface_quartz_move_resize;
|
||||
impl_class->toplevel_resize = gdk_surface_quartz_toplevel_resize;
|
||||
impl_class->move_to_rect = gdk_surface_quartz_move_to_rect;
|
||||
impl_class->get_geometry = gdk_surface_quartz_get_geometry;
|
||||
impl_class->get_root_coords = gdk_surface_quartz_get_root_coords;
|
||||
impl_class->get_device_state = gdk_surface_quartz_get_device_state;
|
||||
|
@ -150,9 +150,20 @@ struct _GdkWaylandSurface
|
||||
} pending_move_to_rect;
|
||||
|
||||
struct {
|
||||
int width;
|
||||
int height;
|
||||
GdkSurfaceState state;
|
||||
struct {
|
||||
int width;
|
||||
int height;
|
||||
GdkSurfaceState state;
|
||||
} toplevel;
|
||||
|
||||
struct {
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
} popup;
|
||||
|
||||
uint32_t serial;
|
||||
} pending;
|
||||
|
||||
struct {
|
||||
@ -170,10 +181,12 @@ struct _GdkWaylandSurfaceClass
|
||||
GdkSurfaceClass parent_class;
|
||||
};
|
||||
|
||||
static void gdk_wayland_surface_maybe_configure (GdkSurface *surface,
|
||||
int width,
|
||||
int height,
|
||||
int scale);
|
||||
static void gdk_wayland_surface_maybe_resize (GdkSurface *surface,
|
||||
int width,
|
||||
int height,
|
||||
int scale);
|
||||
|
||||
static void gdk_wayland_surface_configure (GdkSurface *surface);
|
||||
|
||||
static void maybe_set_gtk_surface_dbus_properties (GdkSurface *surface);
|
||||
static void maybe_set_gtk_surface_modal (GdkSurface *surface);
|
||||
@ -184,6 +197,12 @@ static void gdk_wayland_surface_sync_opaque_region (GdkSurface *surface);
|
||||
|
||||
static void unset_transient_for_exported (GdkSurface *surface);
|
||||
|
||||
static void gdk_wayland_surface_move_resize (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
static void calculate_moved_to_rect_result (GdkSurface *surface,
|
||||
int x,
|
||||
int y,
|
||||
@ -492,7 +511,9 @@ gdk_wayland_surface_update_scale (GdkSurface *surface)
|
||||
}
|
||||
|
||||
/* Notify app that scale changed */
|
||||
gdk_wayland_surface_maybe_configure (surface, surface->width, surface->height, scale);
|
||||
gdk_wayland_surface_maybe_resize (surface,
|
||||
surface->width, surface->height,
|
||||
scale);
|
||||
}
|
||||
|
||||
static void gdk_wayland_surface_create_surface (GdkSurface *surface);
|
||||
@ -649,10 +670,10 @@ gdk_wayland_surface_finalize (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_configure (GdkSurface *surface,
|
||||
int width,
|
||||
int height,
|
||||
int scale)
|
||||
gdk_wayland_surface_resize (GdkSurface *surface,
|
||||
int width,
|
||||
int height,
|
||||
int scale)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkEvent *event;
|
||||
@ -702,10 +723,10 @@ static void gdk_wayland_surface_show (GdkSurface *surface,
|
||||
static void gdk_wayland_surface_hide (GdkSurface *surface);
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_maybe_configure (GdkSurface *surface,
|
||||
int width,
|
||||
int height,
|
||||
int scale)
|
||||
gdk_wayland_surface_maybe_resize (GdkSurface *surface,
|
||||
int width,
|
||||
int height,
|
||||
int scale)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
gboolean is_xdg_popup;
|
||||
@ -728,7 +749,7 @@ gdk_wayland_surface_maybe_configure (GdkSurface *surface,
|
||||
if (is_xdg_popup && is_visible && !impl->initial_configure_received)
|
||||
gdk_wayland_surface_hide (surface);
|
||||
|
||||
gdk_wayland_surface_configure (surface, width, height, scale);
|
||||
gdk_wayland_surface_resize (surface, width, height, scale);
|
||||
|
||||
if (is_xdg_popup && is_visible && !impl->initial_configure_received)
|
||||
gdk_wayland_surface_show (surface, FALSE);
|
||||
@ -1039,44 +1060,27 @@ gdk_wayland_surface_create_surface (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_handle_configure (GdkSurface *surface,
|
||||
uint32_t serial)
|
||||
gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
GdkWaylandDisplay *display_wayland =
|
||||
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||
GdkSurfaceState new_state;
|
||||
int width = impl->pending.width;
|
||||
int height = impl->pending.height;
|
||||
int width, height;
|
||||
gboolean fixed_size;
|
||||
gboolean saved_size;
|
||||
|
||||
if (!impl->initial_configure_received)
|
||||
{
|
||||
gdk_surface_thaw_updates (surface);
|
||||
impl->initial_configure_received = TRUE;
|
||||
}
|
||||
|
||||
if (impl->display_server.xdg_popup)
|
||||
{
|
||||
xdg_surface_ack_configure (impl->display_server.xdg_surface, serial);
|
||||
return;
|
||||
}
|
||||
else if (impl->display_server.zxdg_popup_v6)
|
||||
{
|
||||
zxdg_surface_v6_ack_configure (impl->display_server.zxdg_surface_v6,
|
||||
serial);
|
||||
return;
|
||||
}
|
||||
|
||||
new_state = impl->pending.state;
|
||||
impl->pending.state = 0;
|
||||
new_state = impl->pending.toplevel.state;
|
||||
impl->pending.toplevel.state = 0;
|
||||
|
||||
fixed_size =
|
||||
new_state & (GDK_SURFACE_STATE_MAXIMIZED |
|
||||
GDK_SURFACE_STATE_FULLSCREEN |
|
||||
GDK_SURFACE_STATE_TILED);
|
||||
|
||||
width = impl->pending.toplevel.width;
|
||||
height = impl->pending.toplevel.height;
|
||||
|
||||
saved_size = (width == 0 && height == 0);
|
||||
/* According to xdg_shell, an xdg_surface.configure with size 0x0
|
||||
* should be interpreted as that it is up to the client to set a
|
||||
@ -1113,7 +1117,7 @@ gdk_wayland_surface_handle_configure (GdkSurface *surface,
|
||||
_gdk_wayland_surface_save_size (surface);
|
||||
}
|
||||
|
||||
gdk_wayland_surface_configure (surface, width, height, impl->scale);
|
||||
gdk_wayland_surface_resize (surface, width, height, impl->scale);
|
||||
}
|
||||
|
||||
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
|
||||
@ -1129,11 +1133,12 @@ gdk_wayland_surface_handle_configure (GdkSurface *surface,
|
||||
switch (display_wayland->shell_variant)
|
||||
{
|
||||
case GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL:
|
||||
xdg_surface_ack_configure (impl->display_server.xdg_surface, serial);
|
||||
xdg_surface_ack_configure (impl->display_server.xdg_surface,
|
||||
impl->pending.serial);
|
||||
break;
|
||||
case GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6:
|
||||
zxdg_surface_v6_ack_configure (impl->display_server.zxdg_surface_v6,
|
||||
serial);
|
||||
impl->pending.serial);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
@ -1144,6 +1149,87 @@ gdk_wayland_surface_handle_configure (GdkSurface *surface,
|
||||
gdk_wayland_surface_update_dialogs (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_configure_popup (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
int x, y, width, height;
|
||||
GdkRectangle flipped_rect;
|
||||
GdkRectangle final_rect;
|
||||
gboolean flipped_x;
|
||||
gboolean flipped_y;
|
||||
|
||||
g_return_if_fail (impl->transient_for);
|
||||
|
||||
if (impl->display_server.xdg_popup)
|
||||
{
|
||||
xdg_surface_ack_configure (impl->display_server.xdg_surface,
|
||||
impl->pending.serial);
|
||||
}
|
||||
else if (impl->display_server.zxdg_popup_v6)
|
||||
{
|
||||
zxdg_surface_v6_ack_configure (impl->display_server.zxdg_surface_v6,
|
||||
impl->pending.serial);
|
||||
}
|
||||
|
||||
if (impl->position_method != POSITION_METHOD_MOVE_TO_RECT)
|
||||
return;
|
||||
|
||||
x = impl->pending.popup.x;
|
||||
y = impl->pending.popup.y;
|
||||
width = impl->pending.popup.width;
|
||||
height = impl->pending.popup.height;
|
||||
|
||||
gdk_wayland_surface_resize (surface, width, height, impl->scale);
|
||||
|
||||
calculate_moved_to_rect_result (surface,
|
||||
x, y,
|
||||
width, height,
|
||||
&flipped_rect,
|
||||
&final_rect,
|
||||
&flipped_x,
|
||||
&flipped_y);
|
||||
|
||||
impl->position_method = POSITION_METHOD_MOVE_TO_RECT;
|
||||
|
||||
g_signal_emit_by_name (surface,
|
||||
"moved-to-rect",
|
||||
&flipped_rect,
|
||||
&final_rect,
|
||||
flipped_x,
|
||||
flipped_y);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_configure (GdkSurface *surface)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
if (!impl->initial_configure_received)
|
||||
{
|
||||
gdk_surface_thaw_updates (surface);
|
||||
impl->initial_configure_received = TRUE;
|
||||
}
|
||||
|
||||
if (is_realized_popup (surface))
|
||||
gdk_wayland_surface_configure_popup (surface);
|
||||
else if (is_realized_toplevel (surface))
|
||||
gdk_wayland_surface_configure_toplevel (surface);
|
||||
else
|
||||
g_warn_if_reached ();
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_handle_configure (GdkSurface *surface,
|
||||
uint32_t serial)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
impl->pending.serial = serial;
|
||||
|
||||
gdk_wayland_surface_configure (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_handle_configure_toplevel (GdkSurface *surface,
|
||||
int32_t width,
|
||||
@ -1152,9 +1238,9 @@ gdk_wayland_surface_handle_configure_toplevel (GdkSurface *surface,
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
impl->pending.state |= state;
|
||||
impl->pending.width = width;
|
||||
impl->pending.height = height;
|
||||
impl->pending.toplevel.state |= state;
|
||||
impl->pending.toplevel.width = width;
|
||||
impl->pending.toplevel.height = height;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1433,30 +1519,11 @@ gdk_wayland_surface_handle_configure_popup (GdkSurface *surface,
|
||||
int32_t height)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
GdkRectangle flipped_rect;
|
||||
GdkRectangle final_rect;
|
||||
gboolean flipped_x;
|
||||
gboolean flipped_y;
|
||||
|
||||
g_return_if_fail (impl->transient_for);
|
||||
|
||||
if (impl->position_method != POSITION_METHOD_MOVE_TO_RECT)
|
||||
return;
|
||||
|
||||
calculate_moved_to_rect_result (surface, x, y, width, height,
|
||||
&flipped_rect,
|
||||
&final_rect,
|
||||
&flipped_x,
|
||||
&flipped_y);
|
||||
|
||||
impl->position_method = POSITION_METHOD_MOVE_TO_RECT;
|
||||
|
||||
g_signal_emit_by_name (surface,
|
||||
"moved-to-rect",
|
||||
&flipped_rect,
|
||||
&final_rect,
|
||||
flipped_x,
|
||||
flipped_y);
|
||||
impl->pending.popup.x = x;
|
||||
impl->pending.popup.y = y;
|
||||
impl->pending.popup.width = width;
|
||||
impl->pending.popup.height = height;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1902,9 +1969,9 @@ calculate_moved_to_rect_result (GdkSurface *surface,
|
||||
surface_width = width + surface->shadow_left + surface->shadow_right;
|
||||
surface_height = height + surface->shadow_top + surface->shadow_bottom;
|
||||
|
||||
gdk_surface_move_resize (surface,
|
||||
surface_x, surface_y,
|
||||
surface_width, surface_height);
|
||||
gdk_wayland_surface_move_resize (surface,
|
||||
surface_x, surface_y,
|
||||
surface_width, surface_height);
|
||||
|
||||
calculate_popup_rect (surface,
|
||||
impl->pending_move_to_rect.rect_anchor,
|
||||
@ -2647,7 +2714,6 @@ gdk_wayland_surface_restack_toplevel (GdkSurface *surface,
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_move_resize (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
@ -2655,22 +2721,21 @@ gdk_wayland_surface_move_resize (GdkSurface *surface,
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
if (with_move)
|
||||
{
|
||||
/* Each toplevel has in its own "root" coordinate system */
|
||||
if (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_TOPLEVEL)
|
||||
{
|
||||
surface->x = x;
|
||||
surface->y = y;
|
||||
impl->position_method = POSITION_METHOD_MOVE_RESIZE;
|
||||
}
|
||||
}
|
||||
surface->x = x;
|
||||
surface->y = y;
|
||||
gdk_wayland_surface_maybe_resize (surface, width, height, impl->scale);
|
||||
}
|
||||
|
||||
/* If this function is called with width and height = -1 then that means
|
||||
* just move the surface - don't update its size
|
||||
*/
|
||||
if (width > 0 && height > 0)
|
||||
gdk_wayland_surface_maybe_configure (surface, width, height, impl->scale);
|
||||
static void
|
||||
gdk_wayland_surface_toplevel_resize (GdkSurface *surface,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
gdk_wayland_surface_maybe_resize (surface,
|
||||
width, height,
|
||||
impl->scale);
|
||||
}
|
||||
|
||||
/* Avoid zero width/height as this is a protocol error */
|
||||
@ -2924,7 +2989,7 @@ gtk_surface_configure (void *data,
|
||||
}
|
||||
}
|
||||
|
||||
impl->pending.state |= new_state;
|
||||
impl->pending.toplevel.state |= new_state;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2961,7 +3026,7 @@ gtk_surface_configure_edges (void *data,
|
||||
}
|
||||
}
|
||||
|
||||
impl->pending.state |= new_state;
|
||||
impl->pending.toplevel.state |= new_state;
|
||||
}
|
||||
|
||||
static const struct gtk_surface1_listener gtk_surface_listener = {
|
||||
@ -3663,7 +3728,9 @@ gdk_wayland_surface_set_shadow_width (GdkSurface *surface,
|
||||
(impl->margin_left + impl->margin_right) + (left + right);
|
||||
new_height = surface->height -
|
||||
(impl->margin_top + impl->margin_bottom) + (top + bottom);
|
||||
gdk_wayland_surface_maybe_configure (surface, new_width, new_height, impl->scale);
|
||||
gdk_wayland_surface_maybe_resize (surface,
|
||||
new_width, new_height,
|
||||
impl->scale);
|
||||
|
||||
impl->margin_left = left;
|
||||
impl->margin_right = right;
|
||||
@ -3746,7 +3813,7 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass)
|
||||
impl_class->raise = gdk_wayland_surface_raise;
|
||||
impl_class->lower = gdk_wayland_surface_lower;
|
||||
impl_class->restack_toplevel = gdk_wayland_surface_restack_toplevel;
|
||||
impl_class->move_resize = gdk_wayland_surface_move_resize;
|
||||
impl_class->toplevel_resize = gdk_wayland_surface_toplevel_resize;
|
||||
impl_class->move_to_rect = gdk_wayland_surface_move_to_rect;
|
||||
impl_class->get_geometry = gdk_wayland_surface_get_geometry;
|
||||
impl_class->get_root_coords = gdk_wayland_surface_get_root_coords;
|
||||
|
@ -736,9 +736,9 @@ move_drag_surface (GdkDrag *drag,
|
||||
g_assert (_win32_main_thread == NULL ||
|
||||
_win32_main_thread == g_thread_self ());
|
||||
|
||||
gdk_surface_move (drag_win32->drag_surface,
|
||||
x_root - drag_win32->hot_x,
|
||||
y_root - drag_win32->hot_y);
|
||||
gdk_win32_surface_move (drag_win32->drag_surface,
|
||||
x_root - drag_win32->hot_x,
|
||||
y_root - drag_win32->hot_y);
|
||||
gdk_surface_raise (drag_win32->drag_surface);
|
||||
}
|
||||
|
||||
@ -2090,6 +2090,7 @@ gdk_drag_anim_timeout (gpointer data)
|
||||
gint64 current_time;
|
||||
double f;
|
||||
double t;
|
||||
gint x, y;
|
||||
|
||||
if (!frame_clock)
|
||||
return G_SOURCE_REMOVE;
|
||||
@ -2104,9 +2105,13 @@ gdk_drag_anim_timeout (gpointer data)
|
||||
t = ease_out_cubic (f);
|
||||
|
||||
gdk_surface_show (drag->drag_surface);
|
||||
gdk_surface_move (drag->drag_surface,
|
||||
drag->util_data.last_x + (drag->start_x - drag->util_data.last_x) * t - drag->hot_x,
|
||||
drag->util_data.last_y + (drag->start_y - drag->util_data.last_y) * t - drag->hot_y);
|
||||
x = (drag->util_data.last_x +
|
||||
(drag->start_x - drag->util_data.last_x) * t -
|
||||
drag->hot_x);
|
||||
y = (drag->util_data.last_y +
|
||||
(drag->start_y - drag->util_data.last_y) * t -
|
||||
drag->hot_y);
|
||||
gdk_win32_surface_move (drag->drag_surface, x, y);
|
||||
gdk_surface_set_opacity (drag->drag_surface, 1.0 - f);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
|
@ -1588,7 +1588,9 @@ handle_dpi_changed (GdkSurface *window,
|
||||
_gdk_win32_adjust_client_rect (window, rect);
|
||||
|
||||
if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE)
|
||||
gdk_surface_move_resize (window, window->x, window->y, window->width, window->height);
|
||||
gdk_win32_surface_move_resize (window,
|
||||
window->x, window->y,
|
||||
window->width, window->height);
|
||||
else
|
||||
gdk_surface_resize (window, window->width, window->height);
|
||||
}
|
||||
|
@ -1098,8 +1098,8 @@ gdk_win32_surface_withdraw (GdkSurface *window)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_move (GdkSurface *window,
|
||||
gint x, gint y)
|
||||
gdk_win32_surface_do_move (GdkSurface *window,
|
||||
gint x, gint y)
|
||||
{
|
||||
RECT outer_rect;
|
||||
GdkWin32Surface *impl;
|
||||
@ -1174,11 +1174,11 @@ gdk_win32_surface_resize (GdkSurface *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_move_resize_internal (GdkSurface *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
gdk_win32_surface_do_move_resize (GdkSurface *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
RECT outer_rect;
|
||||
GdkWin32Surface *impl;
|
||||
@ -1224,12 +1224,12 @@ gdk_win32_surface_move_resize_internal (GdkSurface *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_move_resize (GdkSurface *window,
|
||||
gboolean with_move,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
gdk_win32_surface_move_resize_internal (GdkSurface *window,
|
||||
gboolean with_move,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkWin32Surface *surface = GDK_WIN32_SURFACE (window);
|
||||
|
||||
@ -1242,13 +1242,13 @@ gdk_win32_surface_move_resize (GdkSurface *window,
|
||||
|
||||
if (with_move && (width < 0 && height < 0))
|
||||
{
|
||||
gdk_win32_surface_move (window, x, y);
|
||||
gdk_win32_surface_do_move (window, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (with_move)
|
||||
{
|
||||
gdk_win32_surface_move_resize_internal (window, x, y, width, height);
|
||||
gdk_win32_surface_do_move_resize (window, x, y, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1262,6 +1262,80 @@ gdk_win32_surface_move_resize (GdkSurface *window,
|
||||
_gdk_win32_emit_configure_event (window);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_win32_surface_move_resize (GdkSurface *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
gdk_win32_surface_move_resize_internal (window, TRUE, x, y, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_toplevel_resize (GdkSurface *surface,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
gdk_win32_surface_move_resize_internal (surface, FALSE, 0, 0, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_win32_surface_move (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
gdk_win32_surface_move_resize_internal (surface, TRUE, x, y, -1, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_moved_to_rect (GdkSurface *surface,
|
||||
GdkRectangle final_rect)
|
||||
{
|
||||
GdkSurface *toplevel;
|
||||
int x, y;
|
||||
|
||||
if (surface->surface_type == GDK_SURFACE_POPUP)
|
||||
toplevel = surface->parent;
|
||||
else
|
||||
toplevel = surface->transient_for;
|
||||
|
||||
gdk_surface_get_origin (toplevel, &x, &y);
|
||||
x += final_rect.x;
|
||||
y += final_rect.y;
|
||||
|
||||
if (final_rect.width != surface->width ||
|
||||
final_rect.height != surface->height)
|
||||
{
|
||||
gdk_win32_surface_move_resize (surface,
|
||||
x, y,
|
||||
final_rect.width, final_rect.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_win32_surface_move (surface, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_move_to_rect (GdkSurface *surface,
|
||||
const GdkRectangle *rect,
|
||||
GdkGravity rect_anchor,
|
||||
GdkGravity surface_anchor,
|
||||
GdkAnchorHints anchor_hints,
|
||||
gint rect_anchor_dx,
|
||||
gint rect_anchor_dy)
|
||||
{
|
||||
gdk_surface_move_to_rect_helper (surface,
|
||||
rect,
|
||||
rect_anchor,
|
||||
surface_anchor,
|
||||
anchor_hints,
|
||||
rect_anchor_dx,
|
||||
rect_anchor_dy,
|
||||
gdk_win32_surface_moved_to_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_raise (GdkSurface *window)
|
||||
{
|
||||
@ -2518,8 +2592,8 @@ unsnap (GdkSurface *window,
|
||||
|
||||
GDK_NOTE (MISC, g_print ("Unsnapped window size %d x %d @ %d : %d\n", rect.width, rect.height, rect.x, rect.y));
|
||||
|
||||
gdk_surface_move_resize (window, rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
gdk_win32_surface_move_resize (window, rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
|
||||
g_clear_pointer (&impl->snap_stash, g_free);
|
||||
g_clear_pointer (&impl->snap_stash_int, g_free);
|
||||
@ -2624,7 +2698,7 @@ snap_up (GdkSurface *window)
|
||||
width += impl->margins_x;
|
||||
height += impl->margins_y;
|
||||
|
||||
gdk_surface_move_resize (window, x, y, width, height);
|
||||
gdk_win32_surface_move_resize (window, x, y, width, height);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2650,7 +2724,9 @@ snap_left (GdkSurface *window,
|
||||
rect.width = rect.width + impl->margins_x;
|
||||
rect.height = rect.height + impl->margins_y;
|
||||
|
||||
gdk_surface_move_resize (window, rect.x, rect.y, rect.width, rect.height);
|
||||
gdk_win32_surface_move_resize (window,
|
||||
rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2677,7 +2753,9 @@ snap_right (GdkSurface *window,
|
||||
rect.width = rect.width + impl->margins_x;
|
||||
rect.height = rect.height + impl->margins_y;
|
||||
|
||||
gdk_surface_move_resize (window, rect.x, rect.y, rect.width, rect.height);
|
||||
gdk_win32_surface_move_resize (window,
|
||||
rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
}
|
||||
|
||||
void
|
||||
@ -3928,8 +4006,8 @@ setup_drag_move_resize_context (GdkSurface *window,
|
||||
GDK_NOTE (MISC, g_print ("Unsnapped window to %d : %d\n",
|
||||
new_pos.x, new_pos.y));
|
||||
discard_snapinfo (window);
|
||||
gdk_surface_move_resize (window, new_pos.x, new_pos.y,
|
||||
new_pos.width, new_pos.height);
|
||||
gdk_win32_surface_move_resize (window, new_pos.x, new_pos.y,
|
||||
new_pos.width, new_pos.height);
|
||||
}
|
||||
|
||||
|
||||
@ -5082,7 +5160,8 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
|
||||
impl_class->raise = gdk_win32_surface_raise;
|
||||
impl_class->lower = gdk_win32_surface_lower;
|
||||
impl_class->restack_toplevel = gdk_win32_surface_restack_toplevel;
|
||||
impl_class->move_resize = gdk_win32_surface_move_resize;
|
||||
impl_class->toplevel_resize = gdk_win32_surface_toplevel_resize;
|
||||
impl_class->move_to_rect = gdk_win32_surface_move_to_rect;
|
||||
impl_class->get_geometry = gdk_win32_surface_get_geometry;
|
||||
impl_class->get_device_state = gdk_surface_win32_get_device_state;
|
||||
impl_class->get_root_coords = gdk_win32_surface_get_root_coords;
|
||||
|
@ -361,6 +361,15 @@ void _gdk_win32_update_layered_window_from_cache (GdkSurface *window,
|
||||
gboolean do_resize,
|
||||
gboolean do_paint);
|
||||
|
||||
void gdk_win32_surface_move (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
void gdk_win32_surface_move_resize (GdkSurface *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
void
|
||||
gdk_win32_surface_get_queued_window_rect (GdkSurface *surface,
|
||||
|
@ -1459,9 +1459,9 @@ move_drag_surface (GdkDrag *drag,
|
||||
{
|
||||
GdkX11Drag *drag_x11 = GDK_X11_DRAG (drag);
|
||||
|
||||
gdk_surface_move (drag_x11->drag_surface,
|
||||
x_root - drag_x11->hot_x,
|
||||
y_root - drag_x11->hot_y);
|
||||
gdk_x11_surface_move (drag_x11->drag_surface,
|
||||
x_root - drag_x11->hot_x,
|
||||
y_root - drag_x11->hot_y);
|
||||
gdk_surface_raise (drag_x11->drag_surface);
|
||||
}
|
||||
|
||||
@ -1841,9 +1841,9 @@ gdk_drag_anim_timeout (gpointer data)
|
||||
t = ease_out_cubic (f);
|
||||
|
||||
gdk_surface_show (drag->drag_surface);
|
||||
gdk_surface_move (drag->drag_surface,
|
||||
drag->last_x + (drag->start_x - drag->last_x) * t,
|
||||
drag->last_y + (drag->start_y - drag->last_y) * t);
|
||||
gdk_x11_surface_move (drag->drag_surface,
|
||||
drag->last_x + (drag->start_x - drag->last_x) * t,
|
||||
drag->last_y + (drag->start_y - drag->last_y) * t);
|
||||
gdk_surface_set_opacity (drag->drag_surface, 1.0 - f);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
|
@ -1392,6 +1392,71 @@ gdk_x11_surface_move_resize (GdkSurface *surface,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_surface_toplevel_resize (GdkSurface *surface,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
x11_surface_resize (surface, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_x11_surface_move (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
gdk_x11_surface_move_resize (surface, TRUE, x, y, -1, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_surface_moved_to_rect (GdkSurface *surface,
|
||||
GdkRectangle final_rect)
|
||||
{
|
||||
GdkSurface *toplevel;
|
||||
int x, y;
|
||||
|
||||
if (surface->surface_type == GDK_SURFACE_POPUP)
|
||||
toplevel = surface->parent;
|
||||
else
|
||||
toplevel = surface->transient_for;
|
||||
|
||||
gdk_surface_get_origin (toplevel, &x, &y);
|
||||
x += final_rect.x;
|
||||
y += final_rect.y;
|
||||
|
||||
if (final_rect.width != surface->width ||
|
||||
final_rect.height != surface->height)
|
||||
{
|
||||
gdk_x11_surface_move_resize (surface,
|
||||
TRUE,
|
||||
x, y,
|
||||
final_rect.width, final_rect.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_x11_surface_move (surface, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_surface_move_to_rect (GdkSurface *surface,
|
||||
const GdkRectangle *rect,
|
||||
GdkGravity rect_anchor,
|
||||
GdkGravity surface_anchor,
|
||||
GdkAnchorHints anchor_hints,
|
||||
gint rect_anchor_dx,
|
||||
gint rect_anchor_dy)
|
||||
{
|
||||
gdk_surface_move_to_rect_helper (surface,
|
||||
rect,
|
||||
rect_anchor,
|
||||
surface_anchor,
|
||||
anchor_hints,
|
||||
rect_anchor_dx,
|
||||
rect_anchor_dy,
|
||||
gdk_x11_surface_moved_to_rect);
|
||||
}
|
||||
|
||||
static void gdk_x11_surface_restack_toplevel (GdkSurface *surface,
|
||||
GdkSurface *sibling,
|
||||
gboolean above);
|
||||
@ -3245,7 +3310,7 @@ gdk_x11_surface_fullscreen_on_monitor (GdkSurface *surface,
|
||||
return;
|
||||
|
||||
gdk_monitor_get_geometry (monitor, &geom);
|
||||
gdk_surface_move (surface, geom.x, geom.y);
|
||||
gdk_x11_surface_move (surface, geom.x, geom.y);
|
||||
|
||||
gdk_surface_set_fullscreen_mode (surface, GDK_FULLSCREEN_ON_CURRENT_MONITOR);
|
||||
gdk_x11_surface_fullscreen (surface);
|
||||
@ -3887,7 +3952,8 @@ update_pos (MoveResizeData *mv_resize,
|
||||
w, h, &w, &h);
|
||||
}
|
||||
|
||||
gdk_surface_move_resize (mv_resize->moveresize_surface, x, y, w, h);
|
||||
gdk_x11_surface_move_resize (mv_resize->moveresize_surface, TRUE,
|
||||
x, y, w, h);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3896,7 +3962,7 @@ update_pos (MoveResizeData *mv_resize,
|
||||
x = mv_resize->moveresize_orig_x + dx;
|
||||
y = mv_resize->moveresize_orig_y + dy;
|
||||
|
||||
gdk_surface_move (mv_resize->moveresize_surface, x, y);
|
||||
gdk_x11_surface_move (mv_resize->moveresize_surface, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4589,7 +4655,8 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
|
||||
impl_class->raise = gdk_x11_surface_raise;
|
||||
impl_class->lower = gdk_x11_surface_lower;
|
||||
impl_class->restack_toplevel = gdk_x11_surface_restack_toplevel;
|
||||
impl_class->move_resize = gdk_x11_surface_move_resize;
|
||||
impl_class->toplevel_resize = gdk_x11_surface_toplevel_resize;
|
||||
impl_class->move_to_rect = gdk_x11_surface_move_to_rect;
|
||||
impl_class->get_geometry = gdk_x11_surface_get_geometry;
|
||||
impl_class->get_root_coords = gdk_x11_surface_get_root_coords;
|
||||
impl_class->get_device_state = gdk_x11_surface_get_device_state;
|
||||
|
@ -183,6 +183,10 @@ void _gdk_x11_surface_set_surface_scale (GdkSurface *window,
|
||||
|
||||
void gdk_x11_surface_pre_damage (GdkSurface *surface);
|
||||
|
||||
void gdk_x11_surface_move (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_X11_SURFACE__ */
|
||||
|
@ -159,8 +159,6 @@
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Submenu 1</property>
|
||||
<property name="inverted">1</property>
|
||||
<property name="centered">1</property>
|
||||
<property name="menu-name">main</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -215,7 +213,6 @@
|
||||
<property name="action-name">top.set-view</property>
|
||||
<property name="action-target">'list'</property>
|
||||
<property name="iconic">1</property>
|
||||
<property name="centered">1</property>
|
||||
<property name="icon">icon-list</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -225,7 +222,6 @@
|
||||
<property name="action-name">top.set-view</property>
|
||||
<property name="action-target">'grid'</property>
|
||||
<property name="iconic">1</property>
|
||||
<property name="centered">1</property>
|
||||
<property name="icon">icon-grid</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -275,7 +271,6 @@
|
||||
<property name="text">Bold</property>
|
||||
<property name="action-name">top.bold</property>
|
||||
<property name="iconic">1</property>
|
||||
<property name="centered">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -283,7 +278,6 @@
|
||||
<property name="text">Italic</property>
|
||||
<property name="action-name">top.italic</property>
|
||||
<property name="iconic">1</property>
|
||||
<property name="centered">1</property>
|
||||
<property name="icon">icon-italic</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -292,7 +286,6 @@
|
||||
<property name="text">Strikethrough</property>
|
||||
<property name="action-name">top.strikethrough</property>
|
||||
<property name="iconic">1</property>
|
||||
<property name="centered">1</property>
|
||||
<property name="icon">icon-strikethrough</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -301,7 +294,6 @@
|
||||
<property name="text">Underline</property>
|
||||
<property name="action-name">top.underline</property>
|
||||
<property name="iconic">1</property>
|
||||
<property name="centered">1</property>
|
||||
<property name="icon">icon-underline</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -368,8 +360,6 @@
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Submenu 2</property>
|
||||
<property name="inverted">1</property>
|
||||
<property name="centered">1</property>
|
||||
<property name="menu-name">main</property>
|
||||
</object>
|
||||
</child>
|
||||
@ -402,8 +392,6 @@
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Subsubmenu</property>
|
||||
<property name="inverted">1</property>
|
||||
<property name="centered">1</property>
|
||||
<property name="menu-name">submenu2</property>
|
||||
</object>
|
||||
</child>
|
||||
|
Loading…
Reference in New Issue
Block a user