summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/place.c19
-rw-r--r--src/core/prefs.c29
-rw-r--r--src/include/prefs.h4
-rw-r--r--src/org.mate.marco.gschema.xml5
4 files changed, 51 insertions, 6 deletions
diff --git a/src/core/place.c b/src/core/place.c
index c59d9588..b837adb7 100644
--- a/src/core/place.c
+++ b/src/core/place.c
@@ -487,6 +487,13 @@ center_tile_rect_in_area (MetaRectangle *rect,
rect->y = work_area->y + fluff;
}
+center_rect_in_area (MetaRectangle *rect,
+ MetaRectangle *work_area)
+{
+ rect->x = (work_area->width - rect->width) / 2;
+ rect->y = (work_area->height - rect->height) / 2;
+}
+
/* Find the leftmost, then topmost, empty area on the workspace
* that can contain the new window.
*
@@ -554,10 +561,14 @@ find_first_fit (MetaWindow *window,
meta_window_get_work_area_for_xinerama (window, xinerama, &work_area);
- center_tile_rect_in_area (&rect, &work_area);
+ if (meta_prefs_get_center_new_windows ())
+ center_rect_in_area (&rect, &work_area);
+ else
+ center_tile_rect_in_area (&rect, &work_area);
if (meta_rectangle_contains_rect (&work_area, &rect) &&
- !rectangle_overlaps_some_window (&rect, windows))
+ (meta_prefs_get_center_new_windows () ||
+ !rectangle_overlaps_some_window (&rect, windows)))
{
*new_x = rect.x;
*new_y = rect.y;
@@ -874,7 +885,7 @@ meta_window_place (MetaWindow *window,
/* If no placement has been done, revert to cascade to avoid
* fully overlapping window (e.g. starting multiple terminals)
* */
- if (x == xi->rect.x && y == xi->rect.y)
+ if (!meta_prefs_get_center_new_windows() && (x == xi->rect.x && y == xi->rect.y))
find_next_cascade (window, fgeom, windows, x, y, &x, &y);
done_check_denied_focus:
@@ -900,7 +911,7 @@ meta_window_place (MetaWindow *window,
/* Try to do a first fit again, this time only taking into account the
* focus window.
*/
- if (!found_fit)
+ if (!meta_prefs_get_center_new_windows() && !found_fit)
{
GList *focus_window_list;
focus_window_list = g_list_prepend (NULL, focus_window);
diff --git a/src/core/prefs.c b/src/core/prefs.c
index 2581acc2..a3c24132 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -50,6 +50,7 @@
#define KEY_GENERAL_NUM_WORKSPACES "num-workspaces"
#define KEY_GENERAL_COMPOSITOR "compositing-manager"
#define KEY_GENERAL_COMPOSITOR_FAST_ALT_TAB "compositing-fast-alt-tab"
+#define KEY_GENERAL_CENTER_NEW_WINDOWS "center-new-windows"
#define KEY_COMMAND_SCHEMA "org.mate.Marco.keybinding-commands"
#define KEY_COMMAND_PREFIX "command-"
@@ -114,6 +115,7 @@ static int cursor_size = 24;
static gboolean compositing_manager = FALSE;
static gboolean compositing_fast_alt_tab = FALSE;
static gboolean resize_with_right_button = FALSE;
+static gboolean center_new_windows = FALSE;
static gboolean force_fullscreen = TRUE;
static MetaVisualBellType visual_bell_type = META_VISUAL_BELL_FULLSCREEN_FLASH;
@@ -393,6 +395,12 @@ static MetaBoolPreference preferences_bool[] =
&resize_with_right_button,
FALSE,
},
+ { "center-new-windows",
+ KEY_GENERAL_SCHEMA,
+ META_PREF_CENTER_NEW_WINDOWS,
+ &center_new_windows,
+ FALSE,
+ },
{ NULL, NULL, 0, NULL, FALSE },
};
@@ -1529,6 +1537,9 @@ meta_preference_to_string (MetaPreference pref)
case META_PREF_COMPOSITING_FAST_ALT_TAB:
return "COMPOSITING_FAST_ALT_TAB";
+ case META_PREF_CENTER_NEW_WINDOWS:
+ return "CENTER_NEW_WINDOWS";
+
case META_PREF_RESIZE_WITH_RIGHT_BUTTON:
return "RESIZE_WITH_RIGHT_BUTTON";
@@ -2183,11 +2194,17 @@ meta_prefs_get_compositing_manager (void)
}
gboolean
-meta_prefs_get_compositing_fast_alt_tab(void)
+meta_prefs_get_compositing_fast_alt_tab (void)
{
return compositing_fast_alt_tab;
}
+gboolean
+meta_prefs_get_center_new_windows (void)
+{
+ return center_new_windows;
+}
+
guint
meta_prefs_get_mouse_button_resize (void)
{
@@ -2216,7 +2233,7 @@ meta_prefs_set_compositing_manager (gboolean whether)
}
void
-meta_prefs_set_compositing_fast_alt_tab(gboolean whether)
+meta_prefs_set_compositing_fast_alt_tab (gboolean whether)
{
g_settings_set_boolean (settings_general,
KEY_GENERAL_COMPOSITOR_FAST_ALT_TAB,
@@ -2224,6 +2241,14 @@ meta_prefs_set_compositing_fast_alt_tab(gboolean whether)
}
void
+meta_prefs_set_center_new_windows (gboolean whether)
+{
+ g_settings_set_boolean (settings_general,
+ KEY_GENERAL_CENTER_NEW_WINDOWS,
+ whether);
+}
+
+void
meta_prefs_set_force_fullscreen (gboolean whether)
{
force_fullscreen = whether;
diff --git a/src/include/prefs.h b/src/include/prefs.h
index 276f7af6..2b7cfe41 100644
--- a/src/include/prefs.h
+++ b/src/include/prefs.h
@@ -62,6 +62,7 @@ typedef enum
META_PREF_COMPOSITING_MANAGER,
META_PREF_COMPOSITING_FAST_ALT_TAB,
META_PREF_RESIZE_WITH_RIGHT_BUTTON,
+ META_PREF_CENTER_NEW_WINDOWS,
META_PREF_FORCE_FULLSCREEN
} MetaPreference;
@@ -119,6 +120,7 @@ const char* meta_prefs_get_cursor_theme (void);
int meta_prefs_get_cursor_size (void);
gboolean meta_prefs_get_compositing_manager (void);
gboolean meta_prefs_get_compositing_fast_alt_tab (void);
+gboolean meta_prefs_get_center_new_windows (void);
gboolean meta_prefs_get_force_fullscreen (void);
/**
@@ -130,6 +132,8 @@ void meta_prefs_set_compositing_manager (gboolean whether);
void meta_prefs_set_compositing_fast_alt_tab (gboolean whether);
+void meta_prefs_set_center_new_windows (gboolean whether);
+
void meta_prefs_set_force_fullscreen (gboolean whether);
/* XXX FIXME This should be x-macroed, but isn't yet because it would be
diff --git a/src/org.mate.marco.gschema.xml b/src/org.mate.marco.gschema.xml
index 0a5db41c..b8c0ac1f 100644
--- a/src/org.mate.marco.gschema.xml
+++ b/src/org.mate.marco.gschema.xml
@@ -161,6 +161,11 @@
<summary>Disable misfeatures that are required by old or broken applications</summary>
<description>Some applications disregard specifications in ways that result in window manager misfeatures. This option puts Marco in a rigorously correct mode, which gives a more consistent user interface, provided one does not need to run any misbehaving applications.</description>
</key>
+ <key name="center-new-windows" type="b">
+ <default>false</default>
+ <summary>Determine if new windows are created on the center of the screen</summary>
+ <description>By default, marco open new windows on the top left of the screen. If this option is enabled, new windows are open on the center of the screen, instead.</description>
+ </key>
</schema>
<schema id="org.mate.Marco.workspace-names" path="/org/mate/marco/workspace-names/">