summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-05-26 01:05:25 -0400
committerMatthias Clasen <mclasen@redhat.com>2013-05-27 13:31:28 -0400
commitcbe5a3a590d66b9bc1c3d152be593a6dced5475d (patch)
treeae33d6cfba7689c22c40f1deb004a0dc4615c5d6
parent3741a3bfbe06291abc34cbe25e87315aa667a4e4 (diff)
downloadgtk+-cbe5a3a590d66b9bc1c3d152be593a6dced5475d.tar.gz
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
-rw-r--r--gdk/gdkevents.h5
-rw-r--r--gdk/x11/gdkdisplay-x11.c19
-rw-r--r--gtk/gtkwindow.c14
3 files changed, 35 insertions, 3 deletions
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index 999b0d37cb..c0e911cd27 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -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;
/**
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index f3541323f4..42ed1531fb 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -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)
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 1eb3deb3e7..8ff0a216e5 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -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);