[Xfce4-commits] r25836 - in xfwm4/trunk: mcs-plugin src themes/default.keys
Olivier Fourdan
olivier at xfce.org
Sat Jun 23 18:51:36 CEST 2007
Author: olivier
Date: 2007-06-23 16:50:46 +0000 (Sat, 23 Jun 2007)
New Revision: 25836
Modified:
xfwm4/trunk/mcs-plugin/workspaces.c
xfwm4/trunk/mcs-plugin/xfwm4_plugin.c
xfwm4/trunk/mcs-plugin/xfwm4_plugin.h
xfwm4/trunk/mcs-plugin/xfwm4_shortcuteditor.c
xfwm4/trunk/src/client.c
xfwm4/trunk/src/client.h
xfwm4/trunk/src/events.c
xfwm4/trunk/src/frame.c
xfwm4/trunk/src/screen.c
xfwm4/trunk/src/settings.c
xfwm4/trunk/src/settings.h
xfwm4/trunk/themes/default.keys/keythemerc
Log:
Add window fill function (Bug #2319), patch from Stephan Arts (psybsd at gmail.com) applied with changes
Modified: xfwm4/trunk/mcs-plugin/workspaces.c
===================================================================
--- xfwm4/trunk/mcs-plugin/workspaces.c 2007-06-22 18:30:04 UTC (rev 25835)
+++ xfwm4/trunk/mcs-plugin/workspaces.c 2007-06-23 16:50:46 UTC (rev 25836)
@@ -64,7 +64,7 @@
{
NUMBER_COLUMN,
NAME_COLUMN,
- N_COLUMNS
+ THEME_NAME_COLUMNS
};
static void save_workspaces_channel (McsManager * manager);
@@ -440,7 +440,7 @@
gtk_box_pack_start (GTK_BOX (vbox), treeview_scroll, TRUE, TRUE, 0);
gtk_widget_set_size_request (treeview_scroll, -1, 120);
- store = gtk_list_store_new (N_COLUMNS, G_TYPE_INT, G_TYPE_STRING);
+ store = gtk_list_store_new (THEME_NAME_COLUMNS, G_TYPE_INT, G_TYPE_STRING);
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
g_object_unref (G_OBJECT (store));
gtk_widget_show (treeview);
Modified: xfwm4/trunk/mcs-plugin/xfwm4_plugin.c
===================================================================
--- xfwm4/trunk/mcs-plugin/xfwm4_plugin.c 2007-06-22 18:30:04 UTC (rev 25835)
+++ xfwm4/trunk/mcs-plugin/xfwm4_plugin.c 2007-06-23 16:50:46 UTC (rev 25836)
@@ -79,6 +79,7 @@
{N_("Shade window"), "shade"},
{N_("Hide window"), "hide"},
{N_("Maximize window"), "maximize"},
+ {N_("Fill window"), "fill"},
{N_("Nothing"), "none"},
{NULL, NULL}
};
@@ -1566,7 +1567,7 @@
gtk_widget_show (frame);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
- model = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+ model = gtk_list_store_new (KEY_SHORTCUT_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
dialog->treeview3 = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
gtk_widget_show (dialog->treeview3);
gtk_container_add (GTK_CONTAINER (dialog->scrolledwindow3), dialog->treeview3);
@@ -1896,7 +1897,7 @@
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->box_move_check), !box_move);
frame = xfce_create_framebox_with_content (_("Double click action"),
- create_option_menu_box (dbl_click_values, 4,
+ create_option_menu_box (dbl_click_values, 5,
_("Action to perform when double clicking on title bar :"), dbl_click_action,
G_CALLBACK (cb_dblclick_action_value_changed), mcs_plugin));
gtk_widget_show (frame);
@@ -1932,7 +1933,7 @@
static void
setup_dialog (Itf * itf)
{
- GtkTreeModel *model1, *model2;
+ GtkTreeModel *model1, *model2, *model3;
GtkTreeSelection *selection;
ThemeInfo *ti;
@@ -1941,16 +1942,20 @@
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (itf->treeview2), -1, NULL,
gtk_cell_renderer_text_new (), "text", THEME_NAME_COLUMN, NULL);
- model1 = (GtkTreeModel *) gtk_list_store_new (N_COLUMNS, G_TYPE_STRING);
+ model1 = (GtkTreeModel *) gtk_list_store_new (THEME_NAME_COLUMNS, G_TYPE_STRING);
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (model1), 0, sort_func, NULL, NULL);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model1), 0, GTK_SORT_ASCENDING);
gtk_tree_view_set_model (GTK_TREE_VIEW (itf->treeview1), model1);
- model2 = (GtkTreeModel *) gtk_list_store_new (N_COLUMNS, G_TYPE_STRING);
+ model2 = (GtkTreeModel *) gtk_list_store_new (THEME_NAME_COLUMNS, G_TYPE_STRING);
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (model2), 0, sort_func, NULL, NULL);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model2), 0, GTK_SORT_ASCENDING);
gtk_tree_view_set_model (GTK_TREE_VIEW (itf->treeview2), model2);
+ model3 = gtk_tree_view_get_model (GTK_TREE_VIEW (itf->treeview3));
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (model3), 0, sort_func, NULL, NULL);
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model3), 0, GTK_SORT_ASCENDING);
+
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (itf->treeview1));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
g_signal_connect (G_OBJECT (selection), "changed", (GCallback) decoration_selection_changed,
Modified: xfwm4/trunk/mcs-plugin/xfwm4_plugin.h
===================================================================
--- xfwm4/trunk/mcs-plugin/xfwm4_plugin.h 2007-06-22 18:30:04 UTC (rev 25835)
+++ xfwm4/trunk/mcs-plugin/xfwm4_plugin.h 2007-06-23 16:50:46 UTC (rev 25836)
@@ -116,7 +116,7 @@
enum
{
THEME_NAME_COLUMN,
- N_COLUMNS
+ THEME_NAME_COLUMNS
};
enum
@@ -124,7 +124,7 @@
COLUMN_COMMAND,
COLUMN_SHORTCUT,
COLUMN_NAME,
- NUM_COLUMNS
+ KEY_SHORTCUT_COLUMNS
};
typedef enum
Modified: xfwm4/trunk/mcs-plugin/xfwm4_shortcuteditor.c
===================================================================
--- xfwm4/trunk/mcs-plugin/xfwm4_shortcuteditor.c 2007-06-22 18:30:04 UTC (rev 25835)
+++ xfwm4/trunk/mcs-plugin/xfwm4_shortcuteditor.c 2007-06-23 16:50:46 UTC (rev 25836)
@@ -319,6 +319,9 @@
"maximize_window_key",
"maximize_vert_key",
"maximize_horiz_key",
+ "fill_horiz_key",
+ "fill_vert_key",
+ "fill_window_key",
"hide_window_key",
"shade_window_key",
"stick_window_key",
@@ -361,6 +364,9 @@
N_("Maximize window"),
N_("Maximize window vertically"),
N_("Maximize window horizontally"),
+ N_("Fill window horizontally"),
+ N_("Fill window vertically"),
+ N_("Fill window"),
N_("Hide window"),
N_("Shade window"),
N_("Stick window"),
@@ -472,16 +478,16 @@
}
- for (i = 0; !found && i <= 12; i++)
+ for (i = 0; !found && i < 12; i++)
{
gchar *option;
- option = g_strdup_printf ("workspace_%d_key", i);
+ option = g_strdup_printf ("workspace_%d_key", i + 1);
if (g_ascii_strcasecmp (*shortcut, option) == 0)
{
gchar *text;
- text = g_strdup_printf (_("Workspace %d"), i);
+ text = g_strdup_printf (_("Workspace %02d"), i + 1);
gtk_list_store_append (GTK_LIST_STORE (model3), &iter);
gtk_list_store_set (GTK_LIST_STORE (model3), &iter, COLUMN_COMMAND, text,
COLUMN_SHORTCUT, entry_value, COLUMN_NAME, *shortcut, -1);
@@ -493,16 +499,16 @@
g_free (option);
}
- for (i = 0; !found && i <= 12; i++)
+ for (i = 0; !found && i < 12; i++)
{
gchar *option;
- option = g_strdup_printf ("move_window_workspace_%d_key", i);
+ option = g_strdup_printf ("move_window_workspace_%d_key", i + 1);
if (g_ascii_strcasecmp (*shortcut, option) == 0)
{
gchar *text;
- text = g_strdup_printf (_("Move window to workspace %d"), i);
+ text = g_strdup_printf (_("Move window to workspace %02d"), i + 1);
gtk_list_store_append (GTK_LIST_STORE (model3), &iter);
gtk_list_store_set (GTK_LIST_STORE (model3), &iter, COLUMN_COMMAND, text,
COLUMN_SHORTCUT, entry_value, COLUMN_NAME, *shortcut, -1);
Modified: xfwm4/trunk/src/client.c
===================================================================
--- xfwm4/trunk/src/client.c 2007-06-22 18:30:04 UTC (rev 25835)
+++ xfwm4/trunk/src/client.c 2007-06-23 16:50:46 UTC (rev 25836)
@@ -2002,7 +2002,7 @@
for (i = 0; i < STATE_TOGGLED; i++)
{
- xfwmPixmapInit (screen_info, &c->appmenu[i]);
+ xfwmPixmapInit (screen_info, &c->appmenu[i]);
}
for (i = 0; i < SIDE_TOP; i++) /* Keep SIDE_TOP for later */
@@ -3210,6 +3210,204 @@
}
void
+clientFill (Client * c, int fill_type)
+{
+ ScreenInfo *screen_info;
+ DisplayInfo *display_info;
+ GList *window_list;
+ Client *east_neighbour = NULL;
+ Client *west_neighbour = NULL;
+ Client *north_neighbour = NULL;
+ Client *south_neighbour = NULL;
+ Client *c_n;
+ XWindowChanges wc;
+ int mask = 0;
+ int key = fill_type;
+
+ g_return_if_fail (c != NULL);
+
+ if (!CLIENT_CAN_FILL_WINDOW (c))
+ {
+ return;
+ }
+
+ screen_info = c->screen_info;
+ display_info = screen_info->display_info;
+
+ window_list = screen_info->windows;
+
+ while (window_list)
+ {
+ /* Retrieve all windows */
+ c_n = (Client *)window_list->data;
+
+ /* Filter out all windows which are not present on the same
+ * workspace as the client window, aswell as the client window
+ * itself
+ */
+ if ((c->win_workspace == c_n->win_workspace) && (c != window_list->data))
+ {
+ /* Fill horizontally */
+ if (fill_type & CLIENT_FILL_HORIZ)
+ {
+ mask |= CWX | CWWidth;
+
+ /*
+ * check if the neigbour client (c_n) is located
+ * east or west of our client.
+ */
+ if (!(((c->y + c->height) < (c_n->y - frameTop(c_n))) || ((c_n->y + c_n->height) < (c->y - frameTop(c)))))
+ {
+ if ((c_n->x + c_n->width) < c->x)
+ {
+ if (east_neighbour)
+ {
+ /* Check if c_n is closer to the client
+ * then the east neighbour already found
+ */
+ if ((east_neighbour->x + east_neighbour->width) < (c_n->x + c_n->width))
+ {
+ east_neighbour = c_n;
+ }
+ }
+ else
+ {
+ east_neighbour = c_n;
+ }
+ }
+ if ((c->x + c->width) < c_n->x)
+ {
+ /* Check if c_n is closer to the client
+ * then the west neighbour already found
+ */
+ if (west_neighbour)
+ {
+ if (c_n->x < west_neighbour->x)
+ {
+ west_neighbour = c_n;
+ }
+ }
+ else
+ {
+ west_neighbour = c_n;
+ }
+ }
+ }
+ }
+
+ /* Fill vertically */
+ if (fill_type & CLIENT_FILL_VERT)
+ {
+ mask |= CWY | CWHeight;
+
+ /* check if the neigbour client (c_n) is located
+ * north or south of our client.
+ */
+ if (!(((c->x + c->width) < c_n->x) || ((c_n->x + c_n->width) < c->x)))
+ {
+ if ((c_n->y + c_n->height) < c->y)
+ {
+ if (north_neighbour)
+ {
+ /* Check if c_n is closer to the client
+ * then the north neighbour already found
+ */
+ if ((north_neighbour->y + north_neighbour->height) < (c_n->y + c_n->height))
+ {
+ north_neighbour = c_n;
+ }
+ }
+ else
+ {
+ north_neighbour = c_n;
+ }
+ }
+ if ((c->y + c->height) < c_n->y)
+ {
+ if (south_neighbour)
+ {
+ /* Check if c_n is closer to the client
+ * then the south neighbour already found
+ */
+ if (c_n->y < south_neighbour->y)
+ {
+ south_neighbour = c_n;
+ }
+ }
+ else
+ {
+ south_neighbour = c_n;
+ }
+ }
+ }
+ }
+ }
+
+ window_list = g_list_next(window_list);
+ }
+
+ wc.x = c->x;
+
+ /* If there are neighbours, resize to their borders.
+ * If not, resize to the screen-border
+ */
+
+ if (east_neighbour)
+ {
+ wc.x = east_neighbour->x + east_neighbour->width +
+ (frameLeft(c) + frameRight(east_neighbour));
+ }
+ else
+ {
+ wc.x = frameLeft(c);
+ }
+
+ if (west_neighbour)
+ {
+ wc.width = west_neighbour->x - wc.x -
+ (frameRight(c) + frameLeft(west_neighbour));
+ }
+ else
+ {
+ wc.width = screen_info->width - wc.x -
+ (frameRight(c));
+ }
+
+ if (north_neighbour)
+ {
+ wc.y = north_neighbour->y + north_neighbour->height +
+ (frameTop(c) + frameBottom(north_neighbour));
+ }
+ else
+ {
+ wc.y = frameTop(c);
+ }
+
+ if (south_neighbour)
+ {
+ wc.height = south_neighbour->y - wc.y -
+ (frameTop(south_neighbour) + frameBottom(c));
+ }
+ else
+ {
+ wc.height = screen_info->height - wc.y;
+ }
+
+ if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MANAGED))
+ {
+ /*
+ For some reason, the configure can generate EnterNotify events
+ on lower windows, causing a nasty race cond with apps trying to
+ grab focus in focus follow mouse mode. Grab the pointer to
+ avoid these effects
+ */
+ myScreenGrabPointer (c->screen_info, EnterWindowMask, None, myDisplayGetCurrentTime (display_info));
+ clientConfigure(c, &wc, mask, NO_CFG_FLAG);
+ myScreenUngrabPointer (c->screen_info);
+ }
+}
+
+void
clientUpdateOpacity (ScreenInfo *screen_info, Client *focus)
{
DisplayInfo *display_info;
Modified: xfwm4/trunk/src/client.h
===================================================================
--- xfwm4/trunk/src/client.h 2007-06-22 18:30:04 UTC (rev 25835)
+++ xfwm4/trunk/src/client.h 2007-06-23 16:50:46 UTC (rev 25836)
@@ -83,6 +83,12 @@
UPDATE_MAXIMIZE | \
UPDATE_CACHE)
+#define CLIENT_FILL_VERT (1L<<0)
+#define CLIENT_FILL_HORIZ (1L<<1)
+#define CLIENT_FILL (CLIENT_FILL_VERT | \
+ CLIENT_FILL_HORIZ)
+
+
#define STRUTS_SIZE 12
#ifndef CLIENT_MIN_VISIBLE
@@ -195,6 +201,11 @@
XFWM_FLAG_IS_RESIZABLE, \
XFWM_FLAG_LEGACY_FULLSCREEN) && \
!FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
+#define CLIENT_CAN_FILL_WINDOW(c) (FLAG_TEST_AND_NOT(c->xfwm_flags, XFWM_FLAG_HAS_RESIZE | \
+ XFWM_FLAG_IS_RESIZABLE, \
+ XFWM_FLAG_LEGACY_FULLSCREEN) && \
+ !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN | CLIENT_FLAG_MAXIMIZED))
+
#define CLIENT_CAN_STICK_WINDOW(c) (!(c->transient_for) && \
FLAG_TEST(c->xfwm_flags, XFWM_FLAG_HAS_STICK))
@@ -374,6 +385,8 @@
void clientToggleMaximized (Client *,
int,
gboolean);
+void clientFill (Client *,
+ int);
void clientUpdateOpacity (ScreenInfo *,
Client *);
void clientSetOpacity (Client *,
Modified: xfwm4/trunk/src/events.c
===================================================================
--- xfwm4/trunk/src/events.c 2007-06-22 18:30:04 UTC (rev 25835)
+++ xfwm4/trunk/src/events.c 2007-06-23 16:50:46 UTC (rev 25836)
@@ -465,6 +465,15 @@
/* 'nuff for now */
return EVENT_FILTER_REMOVE;
break;
+ case KEY_FILL_WINDOW:
+ clientFill (c, CLIENT_FILL);
+ break;
+ case KEY_FILL_VERT:
+ clientFill (c, CLIENT_FILL_VERT);
+ break;
+ case KEY_FILL_HORIZ:
+ clientFill (c, CLIENT_FILL_HORIZ);
+ break;
default:
break;
}
@@ -711,6 +720,9 @@
case DBL_CLICK_ACTION_SHADE:
clientToggleShaded (c);
break;
+ case DBL_CLICK_ACTION_FILL:
+ clientFill(c, CLIENT_FILL);
+ break;
case DBL_CLICK_ACTION_HIDE:
if (CLIENT_CAN_HIDE_WINDOW (c))
{
Modified: xfwm4/trunk/src/frame.c
===================================================================
--- xfwm4/trunk/src/frame.c 2007-06-22 18:30:04 UTC (rev 25835)
+++ xfwm4/trunk/src/frame.c 2007-06-23 16:50:46 UTC (rev 25836)
@@ -1029,11 +1029,11 @@
right_height = frameHeight (c) - frameTop (c) -
screen_info->corners[CORNER_BOTTOM_RIGHT][state].height;
- xfwmPixmapInit (screen_info, &frame_pix.pm_title);
+// xfwmPixmapInit (screen_info, &frame_pix.pm_title);
xfwmPixmapInit (screen_info, &frame_pix.pm_sides[SIDE_LEFT]);
xfwmPixmapInit (screen_info, &frame_pix.pm_sides[SIDE_RIGHT]);
xfwmPixmapInit (screen_info, &frame_pix.pm_sides[SIDE_BOTTOM]);
- xfwmPixmapInit (screen_info, &frame_pix.pm_sides[SIDE_TOP]);
+// xfwmPixmapInit (screen_info, &frame_pix.pm_sides[SIDE_TOP]);
/* The title is always visible */
frameCreateTitlePixmap (c, state, left, right, &frame_pix.pm_title, &frame_pix.pm_sides[SIDE_TOP]);
Modified: xfwm4/trunk/src/screen.c
===================================================================
--- xfwm4/trunk/src/screen.c 2007-06-22 18:30:04 UTC (rev 25835)
+++ xfwm4/trunk/src/screen.c 2007-06-23 16:50:46 UTC (rev 25836)
@@ -473,6 +473,9 @@
grabKey (dpy, &screen_info->params->keys[KEY_WORKSPACE_10], screen_info->xroot);
grabKey (dpy, &screen_info->params->keys[KEY_WORKSPACE_11], screen_info->xroot);
grabKey (dpy, &screen_info->params->keys[KEY_WORKSPACE_12], screen_info->xroot);
+ grabKey (dpy, &screen_info->params->keys[KEY_FILL_HORIZ], screen_info->xroot);
+ grabKey (dpy, &screen_info->params->keys[KEY_FILL_VERT], screen_info->xroot);
+ grabKey (dpy, &screen_info->params->keys[KEY_FILL_WINDOW], screen_info->xroot);
}
void
Modified: xfwm4/trunk/src/settings.c
===================================================================
--- xfwm4/trunk/src/settings.c 2007-06-22 18:30:04 UTC (rev 25835)
+++ xfwm4/trunk/src/settings.c 2007-06-23 16:50:46 UTC (rev 25836)
@@ -1336,6 +1336,9 @@
parseKeyString (dpy, &screen_info->params->keys[KEY_WORKSPACE_10], getValue ("workspace_10_key", rc));
parseKeyString (dpy, &screen_info->params->keys[KEY_WORKSPACE_11], getValue ("workspace_11_key", rc));
parseKeyString (dpy, &screen_info->params->keys[KEY_WORKSPACE_12], getValue ("workspace_12_key", rc));
+ parseKeyString (dpy, &screen_info->params->keys[KEY_FILL_HORIZ], getValue ("fill_horiz_key", rc));
+ parseKeyString (dpy, &screen_info->params->keys[KEY_FILL_VERT], getValue ("fill_vert_key", rc));
+ parseKeyString (dpy, &screen_info->params->keys[KEY_FILL_WINDOW], getValue ("fill_window_key", rc));
myScreenUngrabKeys (screen_info);
myScreenGrabKeys (screen_info);
@@ -1501,6 +1504,9 @@
{"workspace_10_key", NULL, TRUE},
{"workspace_11_key", NULL, TRUE},
{"workspace_12_key", NULL, TRUE},
+ {"fill_horiz_key", NULL, TRUE},
+ {"fill_vert_key", NULL, TRUE},
+ {"fill_window_key", NULL, TRUE},
{NULL, NULL, FALSE}
};
@@ -1604,6 +1610,10 @@
{
screen_info->params->double_click_action = DBL_CLICK_ACTION_MAXIMIZE;
}
+ else if (!g_ascii_strcasecmp ("fill", value))
+ {
+ screen_info->params->double_click_action = DBL_CLICK_ACTION_FILL;
+ }
else
{
screen_info->params->double_click_action = DBL_CLICK_ACTION_NONE;
Modified: xfwm4/trunk/src/settings.h
===================================================================
--- xfwm4/trunk/src/settings.h 2007-06-22 18:30:04 UTC (rev 25835)
+++ xfwm4/trunk/src/settings.h 2007-06-23 16:50:46 UTC (rev 25836)
@@ -103,6 +103,9 @@
KEY_WORKSPACE_10,
KEY_WORKSPACE_11,
KEY_WORKSPACE_12,
+ KEY_FILL_HORIZ,
+ KEY_FILL_VERT,
+ KEY_FILL_WINDOW,
KEY_COUNT
};
@@ -125,6 +128,7 @@
DBL_CLICK_ACTION_NONE,
DBL_CLICK_ACTION_MAXIMIZE,
DBL_CLICK_ACTION_SHADE,
+ DBL_CLICK_ACTION_FILL,
DBL_CLICK_ACTION_HIDE
};
Modified: xfwm4/trunk/themes/default.keys/keythemerc
===================================================================
--- xfwm4/trunk/themes/default.keys/keythemerc 2007-06-22 18:30:04 UTC (rev 25835)
+++ xfwm4/trunk/themes/default.keys/keythemerc 2007-06-23 16:50:46 UTC (rev 25836)
@@ -5,6 +5,9 @@
cycle_windows_key=Alt+Tab
del_workspace_key=Alt+Delete
down_workspace_key=Control+Alt+Down
+fill_horiz_key=None
+fill_vert_key=None
+fill_window_key=None
fullscreen_key=Alt+F11
hide_window_key=Alt+F8
left_workspace_key=Control+Alt+Left
More information about the Xfce4-commits
mailing list