aboutsummaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'client.c')
-rw-r--r--client.c62
1 files changed, 38 insertions, 24 deletions
diff --git a/client.c b/client.c
index a8e6934..df01ce7 100644
--- a/client.c
+++ b/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $OpenBSD: client.c,v 1.163 2013/12/13 22:39:13 okan Exp $
+ * $OpenBSD: client.c,v 1.164 2013/12/16 19:02:17 okan Exp $
*/
#include <sys/param.h>
@@ -229,6 +229,38 @@ client_freeze(struct client_ctx *cc)
}
void
+client_fullscreen(struct client_ctx *cc)
+{
+ struct screen_ctx *sc = cc->sc;
+ struct geom xine;
+
+ if ((cc->flags & CLIENT_FREEZE) &&
+ !(cc->flags & CLIENT_FULLSCREEN))
+ return;
+
+ if ((cc->flags & CLIENT_FULLSCREEN)) {
+ cc->bwidth = Conf.bwidth;
+ cc->geom = cc->fullgeom;
+ cc->flags &= ~(CLIENT_FULLSCREEN | CLIENT_FREEZE);
+ goto resize;
+ }
+
+ cc->fullgeom = cc->geom;
+
+ xine = screen_find_xinerama(sc,
+ cc->geom.x + cc->geom.w / 2,
+ cc->geom.y + cc->geom.h / 2, CWM_NOGAP);
+
+ cc->bwidth = 0;
+ cc->geom = xine;
+ cc->flags |= (CLIENT_FULLSCREEN | CLIENT_FREEZE);
+
+resize:
+ client_resize(cc, 0);
+ xu_ewmh_set_net_wm_state(cc);
+}
+
+void
client_maximize(struct client_ctx *cc)
{
struct screen_ctx *sc = cc->sc;
@@ -238,9 +270,8 @@ client_maximize(struct client_ctx *cc)
return;
if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) {
- cc->flags &= ~CLIENT_MAXIMIZED;
cc->geom = cc->savegeom;
- cc->bwidth = Conf.bwidth;
+ cc->flags &= ~CLIENT_MAXIMIZED;
goto resize;
}
@@ -263,8 +294,10 @@ client_maximize(struct client_ctx *cc)
cc->geom.x + cc->geom.w / 2,
cc->geom.y + cc->geom.h / 2, CWM_GAP);
- cc->geom = xine;
- cc->bwidth = 0;
+ cc->geom.x = xine.x;
+ cc->geom.y = xine.y;
+ cc->geom.w = xine.w - (cc->bwidth * 2);
+ cc->geom.h = xine.h - (cc->bwidth * 2);
cc->flags |= CLIENT_MAXIMIZED;
resize:
@@ -284,9 +317,6 @@ client_vmaximize(struct client_ctx *cc)
if (cc->flags & CLIENT_VMAXIMIZED) {
cc->geom.y = cc->savegeom.y;
cc->geom.h = cc->savegeom.h;
- cc->bwidth = Conf.bwidth;
- if (cc->flags & CLIENT_HMAXIMIZED)
- cc->geom.w -= cc->bwidth * 2;
cc->flags &= ~CLIENT_VMAXIMIZED;
goto resize;
}
@@ -294,12 +324,6 @@ client_vmaximize(struct client_ctx *cc)
cc->savegeom.y = cc->geom.y;
cc->savegeom.h = cc->geom.h;
- /* if this will make us fully maximized then remove boundary */
- if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_HMAXIMIZED) {
- cc->geom.w += cc->bwidth * 2;
- cc->bwidth = 0;
- }
-
xine = screen_find_xinerama(sc,
cc->geom.x + cc->geom.w / 2,
cc->geom.y + cc->geom.h / 2, CWM_GAP);
@@ -325,9 +349,6 @@ client_hmaximize(struct client_ctx *cc)
if (cc->flags & CLIENT_HMAXIMIZED) {
cc->geom.x = cc->savegeom.x;
cc->geom.w = cc->savegeom.w;
- cc->bwidth = Conf.bwidth;
- if (cc->flags & CLIENT_VMAXIMIZED)
- cc->geom.h -= cc->bwidth * 2;
cc->flags &= ~CLIENT_HMAXIMIZED;
goto resize;
}
@@ -335,12 +356,6 @@ client_hmaximize(struct client_ctx *cc)
cc->savegeom.x = cc->geom.x;
cc->savegeom.w = cc->geom.w;
- /* if this will make us fully maximized then remove boundary */
- if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_VMAXIMIZED) {
- cc->geom.h += cc->bwidth * 2;
- cc->bwidth = 0;
- }
-
xine = screen_find_xinerama(sc,
cc->geom.x + cc->geom.w / 2,
cc->geom.y + cc->geom.h / 2, CWM_GAP);
@@ -359,7 +374,6 @@ client_resize(struct client_ctx *cc, int reset)
{
if (reset) {
cc->flags &= ~CLIENT_MAXIMIZED;
- cc->bwidth = Conf.bwidth;
xu_ewmh_set_net_wm_state(cc);
}