Mutter workspace layout != Overlay layout
- From: Michlal Nanasi <mic gnome-shell ksp sk>
- To: gnome-shell-list gnome org
- Subject: Mutter workspace layout != Overlay layout
- Date: Thu, 17 Sep 2009 20:15:32 +0200
Hi,
There is the difference between workspace(desktops, activities) layout
in overlay and in mutter. Example:
overlay:
1 2 5
3 4 6
mutter:
1 2 3
4 5 6
I didn't like it, so I patched mutter to have gnome-shell's workspace
layout (patch is attached). But it is ugly hack:-) Is there any way, how
mutter know, that gnome-shell is running? I want rewrite it in proper way.
Redgars
Michal Nánási
diff --git a/src/core/screen.c b/src/core/screen.c
index 22cd884..5ff8721 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -2274,6 +2274,26 @@ meta_screen_calc_workspace_layout (MetaScreen *screen,
if (cols <= 0)
cols = num_workspaces / rows + ((num_workspaces % rows) > 0 ? 1 : 0);
+ /* begin of mic's hack */
+
+ if (num_workspaces == 1)
+ rows = cols = 1;
+ else
+ {
+ int square_size = 1;
+ while ( (square_size + 1) * (square_size + 1) < num_workspaces)
+ square_size++; /* can be done by ceil(sqrt) */
+
+ rows = square_size;
+ cols = square_size + 1;
+
+ if (num_workspaces - square_size * square_size > square_size)
+ rows++;
+
+ }
+
+ /* end of mic's hack */
+
/* paranoia */
if (rows < 1)
rows = 1;
@@ -2328,7 +2348,37 @@ meta_screen_calc_workspace_layout (MetaScreen *screen,
current_row = -1;
current_col = -1;
i = 0;
-
+ c = 0;
+ r = 0;
+ int horiz = 1, span = 1;
+
+ for (i = 0; i < grid_area; i++)
+ {
+
+ grid[r*cols+c]=i;
+
+ if (horiz)
+ {
+ c++;
+ if (c == span)
+ {
+ r = 0;
+ horiz = 0;
+ }
+ } else
+ {
+ r++;
+ if (r == span)
+ {
+ c = 0;
+ horiz = 1;
+ span++;
+ }
+
+ }
+ }
+
+ if(0)
switch (screen->starting_corner)
{
case META_SCREEN_TOPLEFT:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]