LOGIN / SIGN UP
First try to get fullscreen detection, code has not yet been tested.
2008-09-29 22:36 7bd7a..60de1
    This introcuses a new option, FullscreenDetect to be put in the Screen
    section. When True pekwm will try to detect non EWMH fullscreen requests
    and make the window go to real fullscreen mode (removing decoration and
    raising it).

src/Frame.cc
 
1921 @@ -1921,23 +1921,9 @@
1921 return; // only handle the active client's events
1922 }
1923
1924 // size before position, as we rely on size when gravitating
1925 if (! client->isCfgDeny(CFG_DENY_SIZE)) {
1926 if ((ev->value_mask&CWWidth) || (ev->value_mask&CWHeight)) {
1927 resizeChild(ev->width, ev->height);
1928 #ifdef HAVE_SHAPE
1929 _client->setShaped(setShape());
1930 #endif // HAVE_SHAPE
1931 }
1932 }
1933
1934 if (! client->isCfgDeny(CFG_DENY_POSITION)) {
1935 if ((ev->value_mask&CWX) || (ev->value_mask&CWY)) {
1936 calcGravityPosition(_client->getXSizeHints()->win_gravity,
1937 ev->x, ev->y, _gm.x, _gm.y);
1938 move(_gm.x, _gm.y);
1939 }
1940 }
1941 // Handled geometry, this is handled seperatley due to fullscreen
1942 // detection
1943 handleConfigureRequestGeometry(ev, client);
1944
1945 // update the stacking
1946 if (! client->isCfgDeny(CFG_DENY_STACKING)) {
...
1960 @@ -1974,6 +1960,48 @@
1960 }
1961 }
1962
1963 /**
1964 * Handle size and position part of configure request, detects
1965 * fullscreen mode if detection is enabled.
1966 */
1967 void
1968 Frame::handleConfigureRequestGeometry(XConfigureRequestEvent *ev, Client *client)
1969 {
1970 // Look for fullscreen requests
1971 long all_geometry = CWX|CWY|CWWidth|CWHeight;
1972 bool is_fullscreen = false;
1973 if (Config::instance()->isFullscreenDetect()
1974 && !client->isCfgDeny(CFG_DENY_SIZE) && !client->isCfgDeny(CFG_DENY_POSITION)
1975 && (ev->value_mask&all_geometry == all_geometry)) {
1976 Geometry gm_request(ev->x, ev->y, ev->width, ev->height);
1977
1978 if (gm_request == _scr->getScreenGeometry()
1979 || gm_request == _scr->getHeadGeometry(_scr->getNearestHead(ev->x, ev->y))) {
1980 is_fullscreen = true;
1981 setStateFullscreen(STATE_SET);
1982 }
1983 }
1984
1985 if (! is_fullscreen) {
1986 // Remove fullscreen state if client changes it size
1987 if (Config::instance()->isFullscreenDetect()) {
1988 setStateFullscreen(STATE_UNSET);
1989 }
1990
1991 if (!client->isCfgDeny(CFG_DENY_SIZE)
1992 && ((ev->value_mask&CWWidth) || (ev->value_mask&CWHeight))) {
1993 resizeChild(ev->width, ev->height);
1994 _client->setShaped(setShape());
1995 }
1996 if (!client->isCfgDeny(CFG_DENY_POSITION)
1997 && ((ev->value_mask&CWX) || (ev->value_mask&CWY))) {
1998 calcGravityPosition(_client->getXSizeHints()->win_gravity,
1999 ev->x, ev->y, _gm.x, _gm.y);
2000 move(_gm.x, _gm.y);
2001 }
2002 }
2003 }
2004
2005 //! @brief
2006 void
2007 Frame::handleClientMessage(XClientMessageEvent *ev, Client *client)
...

src/PScreen.cc
 
86 @@ -86,7 +86,7 @@
86 //! @brief PScreen constructor
87 PScreen::PScreen(Display *dpy) :
88 _dpy(dpy), _fd(-1),
89 _screen(-1), _depth(-1), _width(0), _height(0),
90 _screen(-1), _depth(-1),
91 _root(None), _visual(0), _colormap(None),
92 _modifier_map(0),
93 _num_lock(0), _scroll_lock(0),
...
111 @@ -111,8 +111,8 @@
111 _colormap = DefaultColormap(_dpy, _screen);
112 _modifier_map = XGetModifierMapping(_dpy);
113
114 _width = WidthOfScreen(ScreenOfDisplay(_dpy, _screen));
115 _height = HeightOfScreen(ScreenOfDisplay(_dpy, _screen));
116 _screen_gm.width = WidthOfScreen(ScreenOfDisplay(_dpy, _screen));
117 _screen_gm.height = HeightOfScreen(ScreenOfDisplay(_dpy, _screen));
118
119 #ifdef HAVE_SHAPE
120 {
...
275 @@ -275,8 +275,8 @@
275 // and strut information is updated.
276 initHeads();
277
278 _width = width;
279 _height = height;
280 _screen_gm.width = width;
281 _screen_gm.height = height;
282 PWinObj::getRootPWinObj()->resize(width, height);
283
284 updateStrut();
...
398 @@ -398,6 +398,17 @@
398 }
399 }
400
401 /**
402 * Same as getHeadInfo but returns Geometry instead of filling it in.
403 */
404 Geometry
405 PScreen::getHeadGeometry(uint head)
406 {
407 Geometry gm(_screen_gm);
408 getHeadInfo(head, gm);
409 return gm;
410 }
411
412 //! @brief Fill information about head and the strut.
413 void
414 PScreen::getHeadInfoWithEdge(uint num, Geometry &head)
...
425 @@ -414,14 +425,14 @@
425 head.x += strut_val;
426 head.width -= strut_val;
427
417 strut_val = ((head.x + head.width) == _width) ? std::max(_strut.right, strut.right) : strut.right;
429 strut_val = ((head.x + head.width) == _screen_gm.width) ? std::max(_strut.right, strut.right) : strut.right;
430 head.width -= strut_val;
431
432 strut_val = (head.y == 0) ? std::max(_strut.top, strut.top) : strut.top;
433 head.y += strut_val;
434 head.height -= strut_val;
435
425 strut_val = (head.y + head.height == _height) ? std::max(_strut.bottom, strut.bottom) : strut.bottom;
437 strut_val = (head.y + head.height == _screen_gm.height) ? std::max(_strut.bottom, strut.bottom) : strut.bottom;
438 head.height -= strut_val;
439 }
440
...
541 @@ -530,7 +541,7 @@
541 initHeadsXinerama();
542
543 if (! _heads.size()) {
533 _heads.push_back(Head(0, 0, _width, _height));
545 _heads.push_back(Head(0, 0, _screen_gm.width, _screen_gm.height));
546 }
547 }
548 }
...