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).
| data/config.in | |
| 29 | @@ -29,6 +29,7 @@ |
| 29 | |
| 30 | TrimTitle = "..." |
| 31 | FullscreenAbove = "True" |
| 32 | FullscreenDetect = "True" |
| 33 | EdgeSize = "1" |
| 34 | EdgeIndent = "False" |
| 35 | PixmapCacheSize = "20" |
| ... | |
| src/Config.cc | |
| 54 | @@ -54,6 +54,7 @@ |
| 54 | _screen_workspaces_per_row(0), _screen_workspace_name_default(L"Workspace"), |
| 55 | _screen_edge_indent(false), |
| 56 | _screen_doubleclicktime(250), _screen_fullscreen_above(true), |
| 57 | _screen_fullscreen_detect(true), |
| 58 | _screen_showframelist(true), |
| 59 | _screen_show_status_window(true), _screen_show_client_id(false), |
| 60 | _screen_show_workspace_indicator(500), _screen_workspace_indicator_scale(16), |
| ... | |
| 524 | @@ -523,6 +524,7 @@ |
| 524 | o_key_list.push_back (new CfgParserKeyString ("TRIMTITLE", |
| 525 | _screen_trim_title)); |
| 526 | o_key_list.push_back (new CfgParserKeyBool ("FULLSCREENABOVE", _screen_fullscreen_above, true)); |
| 527 | o_key_list.push_back (new CfgParserKeyBool ("FULLSCREENDETECT", _screen_fullscreen_detect, true)); |
| 528 | o_key_list.push_back (new CfgParserKeyBool ("SHOWFRAMELIST", |
| 529 | _screen_showframelist)); |
| 530 | o_key_list.push_back (new CfgParserKeyBool ("SHOWSTATUSWINDOW", |
| ... | |
| src/Config.hh | |
| 69 | @@ -69,6 +69,7 @@ |
| 69 | inline const std::string &getTrimTitle(void) const { return _screen_trim_title; } |
| 70 | |
| 71 | inline bool isFullscreenAbove(void) const { return _screen_fullscreen_above; } |
| 72 | inline bool isFullscreenDetect(void) const { return _screen_fullscreen_detect; } |
| 73 | |
| 74 | inline bool getShowFrameList(void) const { return _screen_showframelist; } |
| 75 | inline bool isShowStatusWindow(void) const { return _screen_show_status_window; } |
| ... | |
| 197 | @@ -196,6 +197,7 @@ |
| 197 | int _screen_doubleclicktime; |
| 198 | std::string _screen_trim_title; |
| 199 | bool _screen_fullscreen_above; //!< Flag to make fullscreen go above all windows. */ |
| 200 | bool _screen_fullscreen_detect; /**< Flag to make configure request fullscreen detection. */ |
| 201 | bool _screen_showframelist; |
| 202 | bool _screen_show_status_window; |
| 203 | bool _screen_show_client_id; //!< Flag to display client ID in title. |
| ... | |
| src/pekwm.hh | |
| 26 | @@ -26,13 +26,16 @@ |
| 26 | |
| 27 | class Geometry { |
| 28 | public: |
| 29 | Geometry(void) : x(0), y(0), width(1), height(1) { } |
| 30 | Geometry(int _x, int _y, unsigned int _width, unsigned int _height) : |
| 31 | Geometry(void) |
| 32 | : x(0), y(0), width(1), height(1) { } |
| 33 | Geometry(int _x, int _y, unsigned int _width, unsigned int _height) : |
| 34 | x(_x), y(_y), width(_width), height(_height) { } |
| 35 | ~Geometry(void) { } |
| 36 | Geometry(const Geometry &gm) |
| 37 | : x(gm.x), y(gm.y), width(gm.width), height(gm.height) { } |
| 38 | ~Geometry(void) { } |
| 39 | |
| 40 | int x, y; |
| 41 | unsigned int width, height; |
| 42 | int x, y; |
| 43 | unsigned int width, height; |
| 44 | |
| 45 | inline Geometry& operator = (const Geometry& gm) { |
| 46 | x = gm.x; |
| ... | |
| doc/config/configfile/keywords.xml | |
| 150 | @@ -150,6 +150,12 @@ |
| 150 | </listitem> |
| 151 | </varlistentry> |
| 152 | <varlistentry> |
| 153 | <term>FullscreenDetect (boolean)</term> |
| 154 | <listitem> |
| 155 | <para>Toggles detection of broken fullscreen requests setting clients to fullscreen mode when requesting to be the size of the screen. Default true.</para> |
| 156 | </listitem> |
| 157 | </varlistentry> |
| 158 | <varlistentry> |
| 159 | <term>EdgeSize (int) (int) (int) (int)</term> |
| 160 | <listitem> |
| 161 | <para> |
| ... | |
| 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/Frame.hh | |
| 141 | @@ -141,6 +141,7 @@ |
| 141 | // END - PDecor interface |
| 142 | |
| 143 | private: |
| 144 | void handleConfigureRequestGeometry(XConfigureRequestEvent *ev, Client *client); |
| 145 | void recalcResizeDrag(int nx, int ny, bool left, bool top); |
| 146 | void getMaxBounds(int &max_x,int &max_r, int &max_y, int &max_b); |
| 147 | void calcSizeInCells(uint &width, uint &height); |
| ... | |
| 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 | } |
| ... | |
| src/PScreen.hh | |
| 107 | @@ -107,8 +107,10 @@ |
| 107 | inline Display* getDpy(void) const { return _dpy; } |
| 108 | inline int getScreenNum(void) const { return _screen; } |
| 109 | inline Window getRoot(void) const { return _root; } |
| 110 | inline uint getWidth(void) const { return _width; } |
| 111 | inline uint getHeight(void) const { return _height; } |
| 112 | |
| 113 | const Geometry &getScreenGeometry(void) const { return _screen_gm; } |
| 114 | inline uint getWidth(void) const { return _screen_gm.width; } |
| 115 | inline uint getHeight(void) const { return _screen_gm.height; } |
| 116 | |
| 117 | inline int getDepth(void) const { return _depth; } |
| 118 | inline PScreen::PVisual *getVisual(void) { return _visual; } |
| ... | |
| 147 | @@ -145,6 +147,7 @@ |
| 147 | uint getNearestHead(int x, int y); |
| 148 | uint getCurrHead(void); |
| 149 | bool getHeadInfo(uint head, Geometry &head_info); |
| 150 | Geometry getHeadGeometry(uint head); |
| 151 | void getHeadInfoWithEdge(uint head, Geometry &head_info); |
| 152 | inline int getNumHeads(void) const { return _heads.size(); } |
| 153 | |
| ... | |
| 211 | @@ -208,7 +211,8 @@ |
| 211 | int _fd; |
| 212 | |
| 213 | int _screen, _depth; |
| 211 | uint _width, _height; |
| 215 | |
| 216 | Geometry _screen_gm; /**< Screen geometry, no head information. */ |
| 217 | |
| 218 | Window _root; |
| 219 | PScreen::PVisual *_visual; |
| ... | |