forked from AuroraMiddleware/gtk
Add a tiled window state
This information is needed to draw client-side decorations properly in this state. https://bugzilla.gnome.org/show_bug.cgi?id=696001
This commit is contained in:
parent
3741a3bfbe
commit
cbe5a3a590
@ -460,6 +460,8 @@ typedef enum
|
||||
* @GDK_WINDOW_STATE_ABOVE: the window is kept above other windows.
|
||||
* @GDK_WINDOW_STATE_BELOW: the window is kept below other windows.
|
||||
* @GDK_WINDOW_STATE_FOCUSED: the window is presented as focused (with active decorations).
|
||||
* @GDK_WINDOW_TILED: the window is in a tiled state, see
|
||||
* gdk_window_get_tiled_edges() for more details. Since 3.10
|
||||
*
|
||||
* Specifies the state of a toplevel window.
|
||||
*/
|
||||
@ -472,7 +474,8 @@ typedef enum
|
||||
GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
|
||||
GDK_WINDOW_STATE_ABOVE = 1 << 5,
|
||||
GDK_WINDOW_STATE_BELOW = 1 << 6,
|
||||
GDK_WINDOW_STATE_FOCUSED = 1 << 7
|
||||
GDK_WINDOW_STATE_FOCUSED = 1 << 7,
|
||||
GDK_WINDOW_STATE_TILED = 1 << 8
|
||||
} GdkWindowState;
|
||||
|
||||
/**
|
||||
|
@ -247,6 +247,25 @@ do_net_wm_state_changes (GdkWindow *window)
|
||||
GDK_WINDOW_STATE_MAXIMIZED);
|
||||
}
|
||||
|
||||
/* FIXME: we rely on implementation details of mutter here:
|
||||
* mutter only tiles horizontally, and sets maxvert when it does
|
||||
* and if it tiles, it always affects all edges
|
||||
*/
|
||||
if (old_state & GDK_WINDOW_STATE_TILED)
|
||||
{
|
||||
if (!toplevel->have_maxvert)
|
||||
gdk_synthesize_window_state (window,
|
||||
GDK_WINDOW_STATE_TILED,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (toplevel->have_maxvert)
|
||||
gdk_synthesize_window_state (window,
|
||||
0,
|
||||
GDK_WINDOW_STATE_TILED);
|
||||
}
|
||||
|
||||
if (old_state & GDK_WINDOW_STATE_FOCUSED)
|
||||
{
|
||||
if (!toplevel->have_focused)
|
||||
|
@ -209,6 +209,7 @@ struct _GtkWindowPrivate
|
||||
guint client_decorated : 1; /* Decorations drawn client-side */
|
||||
guint custom_title : 1; /* app-provided titlebar */
|
||||
guint fullscreen : 1;
|
||||
guint tiled : 1;
|
||||
|
||||
};
|
||||
|
||||
@ -6120,7 +6121,8 @@ get_decoration_size (GtkWidget *widget,
|
||||
if (!priv->client_decorated)
|
||||
return;
|
||||
|
||||
if (gtk_window_get_maximized (GTK_WINDOW (widget)))
|
||||
if (gtk_window_get_maximized (GTK_WINDOW (widget)) ||
|
||||
GTK_WINDOW (widget)->priv->tiled)
|
||||
return;
|
||||
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
@ -6556,7 +6558,14 @@ gtk_window_state_event (GtkWidget *widget,
|
||||
(event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) ? 1 : 0;
|
||||
}
|
||||
|
||||
if (event->changed_mask & (GDK_WINDOW_STATE_FULLSCREEN | GDK_WINDOW_STATE_MAXIMIZED))
|
||||
if (event->changed_mask & GDK_WINDOW_STATE_TILED)
|
||||
{
|
||||
priv->tiled =
|
||||
(event->new_window_state & GDK_WINDOW_STATE_TILED) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
if (event->changed_mask & (GDK_WINDOW_STATE_FULLSCREEN | GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_TILED))
|
||||
{
|
||||
update_window_buttons (window);
|
||||
gtk_widget_queue_draw (GTK_WIDGET (window));
|
||||
@ -8891,6 +8900,7 @@ gtk_window_draw (GtkWidget *widget,
|
||||
if (priv->client_decorated &&
|
||||
priv->decorated &&
|
||||
!priv->fullscreen &&
|
||||
!priv->tiled &&
|
||||
!gtk_window_get_maximized (GTK_WINDOW (widget)))
|
||||
{
|
||||
gtk_style_context_save (context);
|
||||
|
Loading…
Reference in New Issue
Block a user