forked from AuroraMiddleware/gtk
broadway: Implement maximization
This commit is contained in:
parent
77b8495bc4
commit
ff94923666
@ -92,6 +92,7 @@ _gdk_broadway_screen_size_changed (GdkScreen *screen,
|
||||
{
|
||||
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
|
||||
gint width, height;
|
||||
GList *toplevels, *l;
|
||||
|
||||
width = gdk_screen_get_width (screen);
|
||||
height = gdk_screen_get_height (screen);
|
||||
@ -99,9 +100,22 @@ _gdk_broadway_screen_size_changed (GdkScreen *screen,
|
||||
broadway_screen->width = msg->width;
|
||||
broadway_screen->height = msg->height;
|
||||
|
||||
if (width != gdk_screen_get_width (screen) ||
|
||||
height != gdk_screen_get_height (screen))
|
||||
g_signal_emit_by_name (screen, "size-changed");
|
||||
if (width == gdk_screen_get_width (screen) &&
|
||||
height == gdk_screen_get_height (screen))
|
||||
return;
|
||||
|
||||
g_signal_emit_by_name (screen, "size-changed");
|
||||
toplevels = gdk_screen_get_toplevel_windows (screen);
|
||||
for (l = toplevels; l != NULL; l = l->next)
|
||||
{
|
||||
GdkWindow *toplevel = l->data;
|
||||
GdkWindowImplBroadway *toplevel_impl = GDK_WINDOW_IMPL_BROADWAY (toplevel->impl);
|
||||
|
||||
if (toplevel_impl->maximized)
|
||||
gdk_window_move_resize (toplevel, 0, 0,
|
||||
gdk_screen_get_width (screen),
|
||||
gdk_screen_get_height (screen));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -886,19 +886,57 @@ gdk_broadway_window_unstick (GdkWindow *window)
|
||||
static void
|
||||
gdk_broadway_window_maximize (GdkWindow *window)
|
||||
{
|
||||
GdkWindowImplBroadway *impl;
|
||||
GdkScreen *screen;
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window) ||
|
||||
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
||||
return;
|
||||
|
||||
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
||||
|
||||
if (impl->maximized)
|
||||
return;
|
||||
|
||||
impl->maximized = TRUE;
|
||||
|
||||
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_MAXIMIZED);
|
||||
|
||||
impl->pre_maximize_x = window->x;
|
||||
impl->pre_maximize_y = window->y;
|
||||
impl->pre_maximize_width = window->width;
|
||||
impl->pre_maximize_height = window->height;
|
||||
|
||||
screen = gdk_window_get_screen (window);
|
||||
|
||||
gdk_window_move_resize (window, 0, 0,
|
||||
gdk_screen_get_width (screen),
|
||||
gdk_screen_get_height (screen));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_window_unmaximize (GdkWindow *window)
|
||||
{
|
||||
GdkWindowImplBroadway *impl;
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window) ||
|
||||
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
||||
return;
|
||||
|
||||
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
||||
|
||||
if (!impl->maximized)
|
||||
return;
|
||||
|
||||
impl->maximized = FALSE;
|
||||
|
||||
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_MAXIMIZED, 0);
|
||||
|
||||
gdk_window_move_resize (window,
|
||||
impl->pre_maximize_x,
|
||||
impl->pre_maximize_y,
|
||||
impl->pre_maximize_width,
|
||||
impl->pre_maximize_height);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1397,6 +1435,9 @@ gdk_broadway_window_begin_resize_drag (GdkWindow *window,
|
||||
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
||||
return;
|
||||
|
||||
if (impl->maximized)
|
||||
return;
|
||||
|
||||
mv_resize = get_move_resize_data (gdk_window_get_display (window), TRUE);
|
||||
|
||||
mv_resize->is_resize = TRUE;
|
||||
@ -1434,6 +1475,9 @@ gdk_broadway_window_begin_move_drag (GdkWindow *window,
|
||||
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
|
||||
return;
|
||||
|
||||
if (impl->maximized)
|
||||
return;
|
||||
|
||||
mv_resize = get_move_resize_data (gdk_window_get_display (window), TRUE);
|
||||
|
||||
mv_resize->is_resize = FALSE;
|
||||
|
@ -59,8 +59,14 @@ struct _GdkWindowImplBroadway
|
||||
int id;
|
||||
|
||||
gboolean visible;
|
||||
gboolean maximized;
|
||||
int transient_for;
|
||||
|
||||
int pre_maximize_x;
|
||||
int pre_maximize_y;
|
||||
int pre_maximize_width;
|
||||
int pre_maximize_height;
|
||||
|
||||
gint8 toplevel_window_type;
|
||||
gboolean dirty;
|
||||
gboolean last_synced;
|
||||
|
Loading…
Reference in New Issue
Block a user