mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
Merge branch 'toplevel-move-resize' into 'master'
Toplevel move resize See merge request GNOME/gtk!1923
This commit is contained in:
commit
c0faf0c6b6
@ -185,8 +185,6 @@ gdk_surface_get_display
|
||||
gdk_surface_hide
|
||||
gdk_surface_get_mapped
|
||||
gdk_surface_translate_coordinates
|
||||
gdk_surface_begin_resize_drag
|
||||
gdk_surface_begin_move_drag
|
||||
gdk_surface_beep
|
||||
gdk_surface_get_scale_factor
|
||||
gdk_surface_set_opaque_region
|
||||
@ -673,6 +671,8 @@ gdk_toplevel_set_deletable
|
||||
gdk_toplevel_supports_edge_constraints
|
||||
gdk_toplevel_inhibit_system_shortcuts
|
||||
gdk_toplevel_restore_system_shortcuts
|
||||
gdk_toplevel_begin_resize
|
||||
gdk_toplevel_begin_move
|
||||
<SUBSECTION Standard>
|
||||
GDK_TYPE_TOPLEVEL
|
||||
gdk_toplevel_get_type
|
||||
|
@ -324,7 +324,9 @@
|
||||
<para>
|
||||
A number of minor API cleanups have happened in GdkSurface
|
||||
as well. For example, gdk_surface_input_shape_combine_region()
|
||||
has been renamed to gdk_surface_set_input_region().
|
||||
has been renamed to gdk_surface_set_input_region(), and
|
||||
gdk_surface_begin_resize_drag() has been renamed to
|
||||
gdk_toplevel_begin_resize().
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
@ -1192,18 +1192,17 @@ calculate_unmoving_origin (MoveResizeData *mv_resize)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_broadway_toplevel_begin_resize (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
MoveResizeData *mv_resize;
|
||||
GdkBroadwaySurface *impl;
|
||||
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
return;
|
||||
@ -1235,17 +1234,16 @@ gdk_broadway_surface_begin_resize_drag (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_begin_move_drag (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_broadway_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
MoveResizeData *mv_resize;
|
||||
GdkBroadwaySurface *impl;
|
||||
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
return;
|
||||
@ -1297,8 +1295,6 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
|
||||
impl_class->set_input_region = gdk_broadway_surface_set_input_region;
|
||||
impl_class->destroy = _gdk_broadway_surface_destroy;
|
||||
impl_class->beep = gdk_broadway_surface_beep;
|
||||
impl_class->begin_resize_drag = gdk_broadway_surface_begin_resize_drag;
|
||||
impl_class->begin_move_drag = gdk_broadway_surface_begin_move_drag;
|
||||
impl_class->destroy_notify = gdk_broadway_surface_destroy_notify;
|
||||
impl_class->drag_begin = _gdk_broadway_surface_drag_begin;
|
||||
impl_class->get_scale_factor = gdk_broadway_surface_get_scale_factor;
|
||||
@ -1648,6 +1644,8 @@ gdk_broadway_toplevel_iface_init (GdkToplevelInterface *iface)
|
||||
iface->lower = gdk_broadway_toplevel_lower;
|
||||
iface->focus = gdk_broadway_toplevel_focus;
|
||||
iface->show_window_menu = gdk_broadway_toplevel_show_window_menu;
|
||||
iface->begin_resize = gdk_broadway_toplevel_begin_resize;
|
||||
iface->begin_move = gdk_broadway_toplevel_begin_move;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
|
@ -365,6 +365,21 @@ GdkSurface * gdk_surface_new_temp (GdkDisplay *display,
|
||||
|
||||
GdkKeymap * gdk_display_get_keymap (GdkDisplay *display);
|
||||
|
||||
void gdk_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp);
|
||||
|
||||
void gdk_surface_begin_move_drag (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_INTERNALS_H__ */
|
||||
|
@ -2359,71 +2359,6 @@ gdk_surface_create_similar_surface (GdkSurface * surface,
|
||||
return similar_surface;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_begin_resize_drag:
|
||||
* @surface: a toplevel #GdkSurface
|
||||
* @edge: the edge or corner from which the drag is started
|
||||
* @device: the device used for the operation
|
||||
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
|
||||
* @x: surface X coordinate of mouse click that began the drag
|
||||
* @y: surface Y coordinate of mouse click that began the drag
|
||||
* @timestamp: timestamp of mouse click that began the drag (use gdk_event_get_time())
|
||||
*
|
||||
* Begins a surface resize operation (for a toplevel surface).
|
||||
* You might use this function to implement a “window resize grip,”
|
||||
*/
|
||||
void
|
||||
gdk_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
if (device == NULL)
|
||||
{
|
||||
GdkSeat *seat = gdk_display_get_default_seat (surface->display);
|
||||
if (button == 0)
|
||||
device = gdk_seat_get_keyboard (seat);
|
||||
else
|
||||
device = gdk_seat_get_pointer (seat);
|
||||
}
|
||||
|
||||
GDK_SURFACE_GET_CLASS (surface)->begin_resize_drag (surface, edge, device, button, x, y, timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_begin_move_drag:
|
||||
* @surface: a toplevel #GdkSurface
|
||||
* @device: the device used for the operation
|
||||
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
|
||||
* @x: surface X coordinate of mouse click that began the drag
|
||||
* @y: surface Y coordinate of mouse click that began the drag
|
||||
* @timestamp: timestamp of mouse click that began the drag
|
||||
*
|
||||
* Begins a surface move operation (for a toplevel surface).
|
||||
*/
|
||||
void
|
||||
gdk_surface_begin_move_drag (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
if (device == NULL)
|
||||
{
|
||||
GdkSeat *seat = gdk_display_get_default_seat (surface->display);
|
||||
if (button == 0)
|
||||
device = gdk_seat_get_keyboard (seat);
|
||||
else
|
||||
device = gdk_seat_get_pointer (seat);
|
||||
}
|
||||
|
||||
GDK_SURFACE_GET_CLASS (surface)->begin_move_drag (surface, device, button, x, y, timestamp);
|
||||
}
|
||||
|
||||
/* This function is called when the XWindow is really gone.
|
||||
*/
|
||||
void
|
||||
|
@ -205,23 +205,6 @@ cairo_surface_t *
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_beep (GdkSurface *surface);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_begin_move_drag (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_queue_expose (GdkSurface *surface);
|
||||
|
||||
|
@ -148,19 +148,6 @@ struct _GdkSurfaceClass
|
||||
/* optional */
|
||||
gboolean (* beep) (GdkSurface *surface);
|
||||
|
||||
void (* begin_resize_drag) (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void (* begin_move_drag) (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void (* destroy_notify) (GdkSurface *surface);
|
||||
GdkDrag * (* drag_begin) (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "gdk-private.h"
|
||||
#include "gdktoplevelprivate.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/**
|
||||
* SECTION:gdktoplevel
|
||||
* @Short_description: Interface for toplevel surfaces
|
||||
@ -512,3 +514,82 @@ gdk_toplevel_restore_system_shortcuts (GdkToplevel *toplevel)
|
||||
|
||||
GDK_TOPLEVEL_GET_IFACE (toplevel)->restore_system_shortcuts (toplevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_begin_resize:
|
||||
* @toplevel: a #GdkToplevel
|
||||
* @edge: the edge or corner from which the drag is started
|
||||
* @device: (nullable): the device used for the operation
|
||||
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
|
||||
* @x: surface X coordinate of mouse click that began the drag
|
||||
* @y: surface Y coordinate of mouse click that began the drag
|
||||
* @timestamp: timestamp of mouse click that began the drag (use gdk_event_get_time())
|
||||
*
|
||||
* Begins an interactive resize operation (for a toplevel surface).
|
||||
* You might use this function to implement a “window resize grip.”
|
||||
*/
|
||||
void
|
||||
gdk_toplevel_begin_resize (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
|
||||
|
||||
if (device == NULL)
|
||||
{
|
||||
GdkSeat *seat = gdk_display_get_default_seat (GDK_SURFACE (toplevel)->display);
|
||||
if (button == 0)
|
||||
device = gdk_seat_get_keyboard (seat);
|
||||
else
|
||||
device = gdk_seat_get_pointer (seat);
|
||||
}
|
||||
|
||||
GDK_TOPLEVEL_GET_IFACE (toplevel)->begin_resize (toplevel,
|
||||
edge,
|
||||
device,
|
||||
button,
|
||||
x, y,
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_begin_move:
|
||||
* @toplevel: a #GdkToplevel
|
||||
* @device: the device used for the operation
|
||||
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
|
||||
* @x: surface X coordinate of mouse click that began the drag
|
||||
* @y: surface Y coordinate of mouse click that began the drag
|
||||
* @timestamp: timestamp of mouse click that began the drag
|
||||
*
|
||||
* Begins an interactive move operation (for a toplevel surface).
|
||||
* You might use this function to implement draggable titlebars.
|
||||
*/
|
||||
void
|
||||
gdk_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
|
||||
|
||||
if (device == NULL)
|
||||
{
|
||||
GdkSeat *seat = gdk_display_get_default_seat (GDK_SURFACE (toplevel)->display);
|
||||
if (button == 0)
|
||||
device = gdk_seat_get_keyboard (seat);
|
||||
else
|
||||
device = gdk_seat_get_pointer (seat);
|
||||
}
|
||||
|
||||
GDK_TOPLEVEL_GET_IFACE (toplevel)->begin_move (toplevel,
|
||||
device,
|
||||
button,
|
||||
x, y,
|
||||
timestamp);
|
||||
}
|
||||
|
@ -95,6 +95,23 @@ void gdk_toplevel_inhibit_system_shortcuts (GdkToplevel *toplevel,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_toplevel_restore_system_shortcuts (GdkToplevel *toplevel);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_toplevel_begin_resize (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -24,6 +24,19 @@ struct _GdkToplevelInterface
|
||||
void (* inhibit_system_shortcuts) (GdkToplevel *toplevel,
|
||||
GdkEvent *event);
|
||||
void (* restore_system_shortcuts) (GdkToplevel *toplevel);
|
||||
void (* begin_resize) (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp);
|
||||
void (* begin_move) (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp);
|
||||
};
|
||||
|
||||
typedef enum
|
||||
|
@ -3626,14 +3626,15 @@ gdk_wayland_surface_unfullscreen (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_wayland_toplevel_begin_resize (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkWaylandSurface *impl;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
GdkEventSequence *sequence;
|
||||
@ -3678,7 +3679,7 @@ gdk_wayland_surface_begin_resize_drag (GdkSurface *surface,
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("gdk_surface_begin_resize_drag: bad resize edge %d!", edge);
|
||||
g_warning ("gdk_toplevel_begin_resize: bad resize edge %d!", edge);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3712,13 +3713,14 @@ gdk_wayland_surface_begin_resize_drag (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_begin_move_drag (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_wayland_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkWaylandSurface *impl;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
GdkEventSequence *sequence;
|
||||
@ -3901,8 +3903,6 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass)
|
||||
impl_class->destroy = gdk_wayland_surface_destroy;
|
||||
impl_class->beep = gdk_wayland_surface_beep;
|
||||
|
||||
impl_class->begin_resize_drag = gdk_wayland_surface_begin_resize_drag;
|
||||
impl_class->begin_move_drag = gdk_wayland_surface_begin_move_drag;
|
||||
impl_class->destroy_notify = gdk_wayland_surface_destroy_notify;
|
||||
impl_class->drag_begin = _gdk_wayland_surface_drag_begin;
|
||||
impl_class->get_scale_factor = gdk_wayland_surface_get_scale_factor;
|
||||
@ -4780,6 +4780,8 @@ gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface)
|
||||
iface->supports_edge_constraints = gdk_wayland_toplevel_supports_edge_constraints;
|
||||
iface->inhibit_system_shortcuts = gdk_wayland_toplevel_inhibit_system_shortcuts;
|
||||
iface->restore_system_shortcuts = gdk_wayland_toplevel_restore_system_shortcuts;
|
||||
iface->begin_resize = gdk_wayland_toplevel_begin_resize;
|
||||
iface->begin_move = gdk_wayland_toplevel_begin_move;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -4144,18 +4144,17 @@ gdk_win32_surface_do_move_resize_drag (GdkSurface *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_begin_resize_drag (GdkSurface *window,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_win32_toplevel_begin_resize (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *window = GDK_SURFACE (toplevel);
|
||||
GdkWin32Surface *impl;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (window));
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (window) ||
|
||||
IsIconic (GDK_SURFACE_HWND (window)))
|
||||
return;
|
||||
@ -4181,17 +4180,16 @@ gdk_win32_surface_begin_resize_drag (GdkSurface *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_begin_move_drag (GdkSurface *window,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_win32_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *window = GDK_SURFACE (toplevel);
|
||||
GdkWin32Surface *impl;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (window));
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (window) ||
|
||||
IsIconic (GDK_SURFACE_HWND (window)))
|
||||
return;
|
||||
@ -4709,8 +4707,6 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
|
||||
|
||||
|
||||
impl_class->set_shadow_width = gdk_win32_surface_set_shadow_width;
|
||||
impl_class->begin_resize_drag = gdk_win32_surface_begin_resize_drag;
|
||||
impl_class->begin_move_drag = gdk_win32_surface_begin_move_drag;
|
||||
impl_class->destroy_notify = gdk_win32_surface_destroy_notify;
|
||||
impl_class->drag_begin = _gdk_win32_surface_drag_begin;
|
||||
impl_class->create_gl_context = _gdk_win32_surface_create_gl_context;
|
||||
@ -5089,6 +5085,8 @@ gdk_win32_toplevel_iface_init (GdkToplevelInterface *iface)
|
||||
iface->focus = gdk_win32_toplevel_focus;
|
||||
iface->show_window_menu = gdk_win32_toplevel_show_window_menu;
|
||||
iface->supports_edge_constraints = gdk_win32_toplevel_supports_edge_constraints;
|
||||
iface->begin_resize = gdk_win32_toplevel_begin_resize;
|
||||
iface->begin_move = gdk_win32_toplevel_begin_move;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
|
@ -3709,7 +3709,7 @@ wmspec_resize_drag (GdkSurface *surface,
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("gdk_surface_begin_resize_drag: bad resize edge %d!",
|
||||
g_warning ("gdk_toplevel_begin_resize: bad resize edge %d!",
|
||||
edge);
|
||||
return;
|
||||
}
|
||||
@ -4269,14 +4269,15 @@ _should_perform_ewmh_drag (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_x11_toplevel_begin_resize (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
int root_x, root_y;
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
@ -4292,13 +4293,14 @@ gdk_x11_surface_begin_resize_drag (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_surface_begin_move_drag (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_x11_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
int root_x, root_y;
|
||||
gint direction;
|
||||
|
||||
@ -4589,8 +4591,6 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
|
||||
impl_class->destroy = gdk_x11_surface_destroy;
|
||||
impl_class->beep = gdk_x11_surface_beep;
|
||||
|
||||
impl_class->begin_resize_drag = gdk_x11_surface_begin_resize_drag;
|
||||
impl_class->begin_move_drag = gdk_x11_surface_begin_move_drag;
|
||||
impl_class->destroy_notify = gdk_x11_surface_destroy_notify;
|
||||
impl_class->drag_begin = _gdk_x11_surface_drag_begin;
|
||||
impl_class->get_scale_factor = gdk_x11_surface_get_scale_factor;
|
||||
@ -5044,6 +5044,8 @@ gdk_x11_toplevel_iface_init (GdkToplevelInterface *iface)
|
||||
iface->supports_edge_constraints = gdk_x11_toplevel_supports_edge_constraints;
|
||||
iface->inhibit_system_shortcuts = gdk_x11_toplevel_inhibit_system_shortcuts;
|
||||
iface->restore_system_shortcuts = gdk_x11_toplevel_restore_system_shortcuts;
|
||||
iface->begin_resize = gdk_x11_toplevel_begin_resize;
|
||||
iface->begin_move = gdk_x11_toplevel_begin_move;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
@ -1218,12 +1218,14 @@ click_gesture_pressed_cb (GtkGestureClick *gesture,
|
||||
GdkEventSequence *sequence;
|
||||
GtkWindowRegion region;
|
||||
GdkEvent *event;
|
||||
GdkDevice *device;
|
||||
guint button;
|
||||
double tx, ty;
|
||||
|
||||
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
||||
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
|
||||
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
|
||||
device = gtk_gesture_get_device (GTK_GESTURE (gesture));
|
||||
|
||||
if (!event)
|
||||
return;
|
||||
@ -1234,8 +1236,7 @@ click_gesture_pressed_cb (GtkGestureClick *gesture,
|
||||
if (priv->maximized)
|
||||
return;
|
||||
|
||||
if (gdk_display_device_is_grabbed (gtk_widget_get_display (GTK_WIDGET (window)),
|
||||
gtk_gesture_get_device (GTK_GESTURE (gesture))))
|
||||
if (gdk_display_device_is_grabbed (gtk_widget_get_display (GTK_WIDGET (window)), device))
|
||||
return;
|
||||
|
||||
region = get_active_region_type (window, x, y);
|
||||
@ -1246,12 +1247,12 @@ click_gesture_pressed_cb (GtkGestureClick *gesture,
|
||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
|
||||
gdk_event_get_position (event, &tx, &ty);
|
||||
gdk_surface_begin_resize_drag (priv->surface,
|
||||
(GdkSurfaceEdge) region,
|
||||
gdk_event_get_device ((GdkEvent *) event),
|
||||
GDK_BUTTON_PRIMARY,
|
||||
tx, ty,
|
||||
gdk_event_get_time (event));
|
||||
gdk_toplevel_begin_resize (GDK_TOPLEVEL (priv->surface),
|
||||
(GdkSurfaceEdge) region,
|
||||
device,
|
||||
GDK_BUTTON_PRIMARY,
|
||||
tx, ty,
|
||||
gdk_event_get_time (event));
|
||||
|
||||
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
@ -113,11 +113,12 @@ move_window_clicked (GtkModelButton *button,
|
||||
GtkNative *native = gtk_widget_get_native (GTK_WIDGET (self));
|
||||
GdkSurface *surface = gtk_native_get_surface (native);
|
||||
|
||||
gdk_surface_begin_move_drag (surface,
|
||||
NULL,
|
||||
0, /* 0 means "use keyboard" */
|
||||
0, 0,
|
||||
GDK_CURRENT_TIME);
|
||||
if (GDK_IS_TOPLEVEL (surface))
|
||||
gdk_toplevel_begin_move (GDK_TOPLEVEL (surface),
|
||||
NULL,
|
||||
0, /* 0 means "use keyboard" */
|
||||
0, 0,
|
||||
GDK_CURRENT_TIME);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -127,12 +128,13 @@ resize_window_clicked (GtkModelButton *button,
|
||||
GtkNative *native = gtk_widget_get_native (GTK_WIDGET (self));
|
||||
GdkSurface *surface = gtk_native_get_surface (native);
|
||||
|
||||
gdk_surface_begin_resize_drag (surface,
|
||||
0,
|
||||
NULL,
|
||||
0, /* 0 means "use keyboard" */
|
||||
0, 0,
|
||||
GDK_CURRENT_TIME);
|
||||
if (GDK_IS_TOPLEVEL (surface))
|
||||
gdk_toplevel_begin_resize (GDK_TOPLEVEL (surface),
|
||||
0,
|
||||
NULL,
|
||||
0, /* 0 means "use keyboard" */
|
||||
0, 0,
|
||||
GDK_CURRENT_TIME);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -476,6 +478,7 @@ drag_gesture_update_cb (GtkGestureDrag *gesture,
|
||||
gtk_gesture_drag_get_start_point (gesture, &start_x, &start_y);
|
||||
|
||||
native = gtk_widget_get_native (GTK_WIDGET (self));
|
||||
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (self),
|
||||
GTK_WIDGET (native),
|
||||
start_x, start_y,
|
||||
@ -486,11 +489,12 @@ drag_gesture_update_cb (GtkGestureDrag *gesture,
|
||||
window_y += native_y;
|
||||
|
||||
surface = gtk_native_get_surface (native);
|
||||
gdk_surface_begin_move_drag (surface,
|
||||
gtk_gesture_get_device (GTK_GESTURE (gesture)),
|
||||
gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)),
|
||||
window_x, window_y,
|
||||
gtk_event_controller_get_current_event_time (GTK_EVENT_CONTROLLER (gesture)));
|
||||
if (GDK_IS_TOPLEVEL (surface))
|
||||
gdk_toplevel_begin_move (GDK_TOPLEVEL (surface),
|
||||
gtk_gesture_get_device (GTK_GESTURE (gesture)),
|
||||
gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)),
|
||||
window_x, window_y,
|
||||
gtk_event_controller_get_current_event_time (GTK_EVENT_CONTROLLER (gesture)));
|
||||
|
||||
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
|
||||
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (self->click_gesture));
|
||||
|
@ -28,7 +28,7 @@ start_resize (GtkGestureClick *gesture,
|
||||
|
||||
gtk_widget_translate_coordinates (widget, GTK_WIDGET (gtk_widget_get_root (widget)),
|
||||
xx, yy, &xx, &yy);
|
||||
gdk_surface_begin_resize_drag (surface, edge, gdk_event_get_device (event), button, xx, yy, timestamp);
|
||||
gdk_toplevel_begin_resize (GDK_TOPLEVEL (surface), edge, gdk_event_get_device (event), button, xx, yy, timestamp);
|
||||
|
||||
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
@ -76,7 +76,7 @@ start_move (GtkGestureClick *gesture,
|
||||
|
||||
gtk_widget_translate_coordinates (widget, GTK_WIDGET (gtk_widget_get_root (widget)),
|
||||
xx, yy, &xx, &yy);
|
||||
gdk_surface_begin_move_drag (surface, gdk_event_get_device (event), button, xx, yy, timestamp);
|
||||
gdk_toplevel_begin_move (GDK_TOPLEVEL (surface), gdk_event_get_device (event), button, xx, yy, timestamp);
|
||||
gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user