[Xfce4-commits] [xfce/xfwm4] 01/07: Implement corner tiling.
noreply at xfce.org
noreply at xfce.org
Tue Jan 20 22:31:56 CET 2015
This is an automated email from the git hooks/post-receive script.
olivier pushed a commit to branch master
in repository xfce/xfwm4.
commit 728cce0e8f09d7f20f29ab3d41086d7798f77da8
Author: Alistair Buxton <a.j.buxton at gmail.com>
Date: Wed Mar 19 11:22:08 2014 +0000
Implement corner tiling.
The extra key shortcuts have to be defined in libxfce4ui, so you
need a matching version of that.
---
src/client.c | 39 ++++++++++++++++++++++++++++++++++++++-
src/client.h | 6 +++++-
src/events.c | 20 ++++++++++++++++++++
src/settings.c | 4 ++++
src/settings.h | 4 ++++
5 files changed, 71 insertions(+), 2 deletions(-)
diff --git a/src/client.c b/src/client.c
index 0e890cf..c1a5496 100644
--- a/src/client.c
+++ b/src/client.c
@@ -3235,7 +3235,38 @@ clientNewMaxSize (Client *c, XWindowChanges *wc, GdkRectangle *rect, tilePositio
return (wc->height <= c->size->max_height);
}
- return TRUE;
+ switch (tile)
+ {
+ case TILE_DOWN_LEFT:
+ wc->x = full_x + frameExtentLeft (c);
+ wc->width = full_w / 2 - frameExtentLeft (c) - frameExtentRight (c);
+ wc->y = full_y + full_h / 2 + frameExtentTop (c);
+ wc->height = full_h - full_h / 2 - frameExtentTop (c) - frameExtentBottom (c);
+ break;
+ case TILE_DOWN_RIGHT:
+ wc->x = full_x + full_w /2 + frameExtentLeft (c);
+ wc->width = full_w - full_w / 2 - frameExtentLeft (c) - frameExtentRight (c);
+ wc->y = full_y + full_h / 2 + frameExtentTop (c);
+ wc->height = full_h - full_h / 2 - frameExtentTop (c) - frameExtentBottom (c);
+ break;
+ case TILE_UP_LEFT:
+ wc->x = full_x + frameExtentLeft (c);
+ wc->width = full_w / 2 - frameExtentLeft (c) - frameExtentRight (c);
+ wc->y = full_y + frameExtentTop (c);
+ wc->height = full_h / 2 - frameExtentTop (c) - frameExtentBottom (c);
+ break;
+ case TILE_UP_RIGHT:
+ wc->x = full_x + full_w /2 + frameExtentLeft (c);
+ wc->width = full_w - full_w / 2 - frameExtentLeft (c) - frameExtentRight (c);
+ wc->y = full_y + frameExtentTop (c);
+ wc->height = full_h / 2 - frameExtentTop (c) - frameExtentBottom (c);
+ break;
+ default:
+ return TRUE;
+ break;
+ }
+
+ return (wc->height <= c->size->max_height) && (wc->width <= c->size->max_width);
}
gboolean
@@ -3355,6 +3386,12 @@ clientTile (Client *c, gint cx, gint cy, tilePositionType tile, gboolean send_co
case TILE_DOWN:
mode = CLIENT_FLAG_MAXIMIZED_HORIZ;
break;
+ case TILE_DOWN_LEFT:
+ case TILE_DOWN_RIGHT:
+ case TILE_UP_LEFT:
+ case TILE_UP_RIGHT:
+ mode = 0;
+ break;
default:
return FALSE;
break;
diff --git a/src/client.h b/src/client.h
index 77256da..94edadc 100644
--- a/src/client.h
+++ b/src/client.h
@@ -262,7 +262,11 @@ typedef enum
TILE_LEFT,
TILE_RIGHT,
TILE_DOWN,
- TILE_UP
+ TILE_UP,
+ TILE_DOWN_LEFT,
+ TILE_DOWN_RIGHT,
+ TILE_UP_LEFT,
+ TILE_UP_RIGHT
}
tilePositionType;
diff --git a/src/events.c b/src/events.c
index ccc836f..1da35c3 100644
--- a/src/events.c
+++ b/src/events.c
@@ -448,6 +448,26 @@ handleKeyPress (DisplayInfo *display_info, XKeyEvent * ev)
frameY (c) + frameHeight (c) / 2,
TILE_UP, TRUE);
break;
+ case KEY_TILE_DOWN_LEFT:
+ clientTile (c, frameX (c) + frameWidth (c) / 2,
+ frameY (c) + frameHeight (c) / 2,
+ TILE_DOWN_LEFT, TRUE);
+ break;
+ case KEY_TILE_DOWN_RIGHT:
+ clientTile (c, frameX (c) + frameWidth (c) / 2,
+ frameY (c) + frameHeight (c) / 2,
+ TILE_DOWN_RIGHT, TRUE);
+ break;
+ case KEY_TILE_UP_LEFT:
+ clientTile (c, frameX (c) + frameWidth (c) / 2,
+ frameY (c) + frameHeight (c) / 2,
+ TILE_UP_LEFT, TRUE);
+ break;
+ case KEY_TILE_UP_RIGHT:
+ clientTile (c, frameX (c) + frameWidth (c) / 2,
+ frameY (c) + frameHeight (c) / 2,
+ TILE_UP_RIGHT, TRUE);
+ break;
default:
break;
}
diff --git a/src/settings.c b/src/settings.c
index ee0995c..affe875 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -646,6 +646,10 @@ loadKeyBindings (ScreenInfo *screen_info)
parseShortcut (screen_info, KEY_TILE_LEFT, "tile_left_key", shortcuts);
parseShortcut (screen_info, KEY_TILE_RIGHT, "tile_right_key", shortcuts);
parseShortcut (screen_info, KEY_TILE_UP, "tile_up_key", shortcuts);
+ parseShortcut (screen_info, KEY_TILE_DOWN_LEFT, "tile_down_left_key", shortcuts);
+ parseShortcut (screen_info, KEY_TILE_DOWN_RIGHT, "tile_down_right_key", shortcuts);
+ parseShortcut (screen_info, KEY_TILE_UP_LEFT, "tile_up_left_key", shortcuts);
+ parseShortcut (screen_info, KEY_TILE_UP_RIGHT, "tile_up_right_key", shortcuts);
parseShortcut (screen_info, KEY_TOGGLE_ABOVE, "above_key", shortcuts);
parseShortcut (screen_info, KEY_TOGGLE_FULLSCREEN, "fullscreen_key", shortcuts);
parseShortcut (screen_info, KEY_UP_WORKSPACE, "up_workspace_key", shortcuts);
diff --git a/src/settings.h b/src/settings.h
index 0896e73..7c84b32 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -104,6 +104,10 @@ enum
KEY_TILE_LEFT,
KEY_TILE_RIGHT,
KEY_TILE_UP,
+ KEY_TILE_DOWN_LEFT,
+ KEY_TILE_DOWN_RIGHT,
+ KEY_TILE_UP_LEFT,
+ KEY_TILE_UP_RIGHT,
KEY_TOGGLE_ABOVE,
KEY_TOGGLE_FULLSCREEN,
KEY_UP_WORKSPACE,
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list