Commit 9b3c745f authored by Jonas Ådahl's avatar Jonas Ådahl
Browse files

gdk: Make gdk_window_move_to_rect public

This is the API used by GtkMenu to properly position menus on the screen
without requiring GTK to query the menu window's position or the work
area of where the window is positioned. It makes it possible to position
popup windows properly when using Wayland.

Make this API available to external users so custom popup windows can be
positioned properly as well.

Closes: #997
parent 91748d1a
......@@ -17,7 +17,6 @@ gdk__private__ (void)
gdk_display_set_rendering_mode,
gdk_display_get_debug_updates,
gdk_display_set_debug_updates,
gdk_window_move_to_rect
};
return &table;
......
......@@ -31,14 +31,6 @@ gboolean gdk_display_get_debug_updates (GdkDisplay *display);
void gdk_display_set_debug_updates (GdkDisplay *display,
gboolean debug_updates);
void gdk_window_move_to_rect (GdkWindow *window,
const GdkRectangle *rect,
GdkGravity rect_anchor,
GdkGravity window_anchor,
GdkAnchorHints anchor_hints,
gint rect_anchor_dx,
gint rect_anchor_dy);
typedef struct {
/* add all private functions here, initialize them in gdk-private.c */
gboolean (* gdk_device_grab_info) (GdkDisplay *display,
......@@ -64,14 +56,6 @@ typedef struct {
gboolean (* gdk_display_get_debug_updates) (GdkDisplay *display);
void (* gdk_display_set_debug_updates) (GdkDisplay *display,
gboolean debug_updates);
void (* gdk_window_move_to_rect) (GdkWindow *window,
const GdkRectangle *rect,
GdkGravity rect_anchor,
GdkGravity window_anchor,
GdkAnchorHints anchor_hints,
gint rect_anchor_dx,
gint rect_anchor_dy);
} GdkPrivateVTable;
GDK_AVAILABLE_IN_ALL
......
......@@ -6233,8 +6233,7 @@ gdk_window_move_resize (GdkWindow *window,
* Connect to the #GdkWindow::moved-to-rect signal to find out how it was
* actually positioned.
*
* Since: 3.22
* Stability: Private
* Since: 3.24
*/
void
gdk_window_move_to_rect (GdkWindow *window,
......
......@@ -550,6 +550,15 @@ void gdk_window_move_resize (GdkWindow *window,
gint y,
gint width,
gint height);
GDK_AVAILABLE_IN_3_24
void gdk_window_move_to_rect (GdkWindow *window,
const GdkRectangle *rect,
GdkGravity rect_anchor,
GdkGravity window_anchor,
GdkAnchorHints anchor_hints,
gint rect_anchor_dx,
gint rect_anchor_dy);
GDK_AVAILABLE_IN_ALL
void gdk_window_reparent (GdkWindow *window,
GdkWindow *new_parent,
......
......@@ -5274,13 +5274,13 @@ gtk_menu_position (GtkMenu *menu,
g_signal_connect (toplevel, "moved-to-rect", G_CALLBACK (moved_to_rect_cb),
menu);
GDK_PRIVATE_CALL (gdk_window_move_to_rect) (toplevel,
&rect,
rect_anchor,
menu_anchor,
anchor_hints,
rect_anchor_dx,
rect_anchor_dy);
gdk_window_move_to_rect (toplevel,
&rect,
rect_anchor,
menu_anchor,
anchor_hints,
rect_anchor_dx,
rect_anchor_dy);
}
static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment