Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5130272 to your computer and use it in GitHub Desktop.
Save anonymous/5130272 to your computer and use it in GitHub Desktop.
0001-Added-titleless-maximization-feature.patch
From 62116f697438d9e29967d3a081ac80515a88c275 Mon Sep 17 00:00:00 2001
From: Viktor Semykin <thesame.ml@gmail.com>
Date: Sun, 10 Mar 2013 22:03:54 +0200
Subject: [PATCH] Added titleless maximization feature
---
defaults/defaults | 1 +
settings-dialogs/tweaks-settings.c | 5 +++++
settings-dialogs/xfwm4-settings.c | 2 +-
settings-dialogs/xfwm4-tweaks-dialog.glade | 32 ++++++++++++++++++++++--------
src/client.c | 2 ++
src/frame.c | 8 +++++++-
src/placement.c | 4 +++-
src/settings.c | 8 ++++++++
src/settings.h | 1 +
9 files changed, 52 insertions(+), 11 deletions(-)
diff --git a/defaults/defaults b/defaults/defaults
index 6db210a..1582fc1 100644
--- a/defaults/defaults
+++ b/defaults/defaults
@@ -1,5 +1,6 @@
activate_action=bring
borderless_maximize=true
+titleless_maximize=false
box_move=false
box_resize=false
button_layout=O|SHMC
diff --git a/settings-dialogs/tweaks-settings.c b/settings-dialogs/tweaks-settings.c
index f60b606..2532733 100644
--- a/settings-dialogs/tweaks-settings.c
+++ b/settings-dialogs/tweaks-settings.c
@@ -180,6 +180,7 @@ wm_tweaks_dialog_configure_widgets (GtkBuilder *builder)
GtkWidget *easy_click_combo_box = GTK_WIDGET (gtk_builder_get_object (builder, "easy_click_combo_box"));
GtkWidget *raise_with_any_button_check = GTK_WIDGET (gtk_builder_get_object (builder, "raise_with_any_button_check"));
GtkWidget *borderless_maximize_check = GTK_WIDGET (gtk_builder_get_object (builder, "borderless_maximize_check"));
+ GtkWidget *titleless_maximize_check = GTK_WIDGET (gtk_builder_get_object (builder, "titleless_maximize_check"));
GtkWidget *restore_on_move_check = GTK_WIDGET (gtk_builder_get_object (builder, "restore_on_move_check"));
GtkWidget *tile_on_move_check = GTK_WIDGET (gtk_builder_get_object (builder, "tile_on_move_check"));
GtkWidget *snap_resist_check = GTK_WIDGET (gtk_builder_get_object (builder, "snap_resist_check"));
@@ -336,6 +337,10 @@ wm_tweaks_dialog_configure_widgets (GtkBuilder *builder)
G_TYPE_BOOLEAN,
(GObject *)borderless_maximize_check, "active");
xfconf_g_property_bind (xfwm4_channel,
+ "/general/titleless_maximize",
+ G_TYPE_BOOLEAN,
+ (GObject *)titleless_maximize_check, "active");
+ xfconf_g_property_bind (xfwm4_channel,
"/general/restore_on_move",
G_TYPE_BOOLEAN,
(GObject *)restore_on_move_check, "active");
diff --git a/settings-dialogs/xfwm4-settings.c b/settings-dialogs/xfwm4-settings.c
index 4f284d3..bb86e04 100644
--- a/settings-dialogs/xfwm4-settings.c
+++ b/settings-dialogs/xfwm4-settings.c
@@ -1635,7 +1635,7 @@ xfwm_settings_initialize_shortcuts (XfwmSettings *settings)
gtk_list_store_clear (GTK_LIST_STORE (model));
- if (feature_list = xfce_shortcuts_xfwm4_get_feature_list ())
+ if ((feature_list = xfce_shortcuts_xfwm4_get_feature_list ()))
{
GList *l;
diff --git a/settings-dialogs/xfwm4-tweaks-dialog.glade b/settings-dialogs/xfwm4-tweaks-dialog.glade
index e9996af..7b509ef 100644
--- a/settings-dialogs/xfwm4-tweaks-dialog.glade
+++ b/settings-dialogs/xfwm4-tweaks-dialog.glade
@@ -415,8 +415,8 @@ or "skip taskbar" properties set</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="restore_on_move_check">
- <property name="label" translatable="yes">Restore original size of maximi_zed windows when moving</property>
+ <object class="GtkCheckButton" id="titleless_maximize_check">
+ <property name="label" translatable="yes">Hide title of windows when maximized</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -431,8 +431,8 @@ or "skip taskbar" properties set</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="tile_on_move_check">
- <property name="label" translatable="yes">Automatically _tile windows when moving toward the screen edge</property>
+ <object class="GtkCheckButton" id="restore_on_move_check">
+ <property name="label" translatable="yes">Restore original size of maximi_zed windows when moving</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -447,8 +447,8 @@ or "skip taskbar" properties set</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="urgent_blink">
- <property name="label" translatable="yes">Notify of _urgency by making window's decoration blink</property>
+ <object class="GtkCheckButton" id="tile_on_move_check">
+ <property name="label" translatable="yes">Automatically _tile windows when moving toward the screen edge</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -475,7 +475,23 @@ or "skip taskbar" properties set</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">5</property>
+ <property name="position">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="urgent_blink">
+ <property name="label" translatable="yes">Notify of _urgency by making window's decoration blink</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
@@ -491,7 +507,7 @@ or "skip taskbar" properties set</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">6</property>
+ <property name="position">7</property>
</packing>
</child>
</object>
diff --git a/src/client.c b/src/client.c
index 4e86808..6eb14d7 100644
--- a/src/client.c
+++ b/src/client.c
@@ -3137,6 +3137,8 @@ clientNewMaxSize (Client *c, XWindowChanges *wc, GdkRectangle *rect, tilePositio
wc->width = full_w - frameLeft (c) - frameRight (c);
wc->height = full_h - frameTop (c) - frameBottom (c);
+ TRACE ("clientNewMaxSize %d %d %d %d", wc->x, wc->y, wc->width, wc->height);
+
return ((wc->width <= c->size->max_width) && (wc->height <= c->size->max_height));
}
diff --git a/src/frame.c b/src/frame.c
index 7f4cbd3..772254f 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -121,7 +121,13 @@ frameTop (Client * c)
g_return_val_if_fail (c != NULL, 0);
if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
- && !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
+ && !(FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
+ || (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED | CLIENT_FLAG_MAXIMIZED_VERT)
+ && c->screen_info->params->titleless_maximize
+ && c->screen_info->params->borderless_maximize
+ )
+ )
+ )
{
return c->screen_info->title[TITLE_3][ACTIVE].height;
}
diff --git a/src/placement.c b/src/placement.c
index 732f01d..544bda1 100644
--- a/src/placement.c
+++ b/src/placement.c
@@ -38,7 +38,6 @@
#include "frame.h"
#include "netwm.h"
-
/* Compute rectangle overlap area */
static inline unsigned long
@@ -108,6 +107,8 @@ clientMaxSpace (ScreenInfo *screen_info, int *x, int *y, int *w, int *h)
g_return_if_fail (w != NULL);
g_return_if_fail (h != NULL);
+ TRACE ("entering clientMaxSpace");
+
screen_width = 0;
screen_height = 0;
delta = 0;
@@ -157,6 +158,7 @@ clientMaxSpace (ScreenInfo *screen_info, int *x, int *y, int *w, int *h)
}
}
}
+ TRACE ("clientMaxSpace result %d %d %d %d", *x, *y, *w, *h);
}
gboolean
diff --git a/src/settings.c b/src/settings.c
index 607bb7b..37b6c2a 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -667,6 +667,7 @@ loadSettings (ScreenInfo *screen_info)
/* You can change the order of the following parameters */
{"activate_action", NULL, G_TYPE_STRING, TRUE},
{"borderless_maximize", NULL, G_TYPE_BOOLEAN, TRUE},
+ {"titleless_maximize", NULL, G_TYPE_BOOLEAN, TRUE},
{"box_move", NULL, G_TYPE_BOOLEAN, TRUE},
{"box_resize", NULL, G_TYPE_BOOLEAN, TRUE},
{"button_layout", NULL, G_TYPE_STRING, TRUE},
@@ -753,6 +754,8 @@ loadSettings (ScreenInfo *screen_info)
screen_info->params->borderless_maximize =
getBoolValue ("borderless_maximize", rc);
+ screen_info->params->titleless_maximize =
+ getBoolValue ("titleless_maximize", rc);
screen_info->params->box_resize =
getBoolValue ("box_resize", rc);
screen_info->params->box_move =
@@ -1261,6 +1264,11 @@ cb_xfwm4_channel_property_changed(XfconfChannel *channel, const gchar *property_
screen_info->params->borderless_maximize = g_value_get_boolean (value);
reloadScreenSettings (screen_info, UPDATE_MAXIMIZE);
}
+ else if (!strcmp (name, "titleless_maximize"))
+ {
+ screen_info->params->titleless_maximize = g_value_get_boolean (value);
+ reloadScreenSettings (screen_info, UPDATE_MAXIMIZE);
+ }
else if (!strcmp (name, "cycle_minimum"))
{
screen_info->params->cycle_minimum = g_value_get_boolean (value);
diff --git a/src/settings.h b/src/settings.h
index be01b6b..ea8b79b 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -197,6 +197,7 @@ struct _XfwmParams
int title_shadow[2];
int wrap_resistance;
gboolean borderless_maximize;
+ gboolean titleless_maximize;
gboolean box_move;
gboolean box_resize;
gboolean click_to_focus;
--
1.8.1.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment