[vlc-commits] skins(x11): query WorkArea when available
Erwan Tulou
git at videolan.org
Mon Jan 29 22:26:54 CET 2018
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Mon Jan 29 21:15:18 2018 +0100| [cc07586876ef6a3d13e77d1b4e261b34b1f483da] | committer: Erwan Tulou
skins(x11): query WorkArea when available
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cc07586876ef6a3d13e77d1b4e261b34b1f483da
---
modules/gui/skins2/x11/x11_display.cpp | 1 +
modules/gui/skins2/x11/x11_display.hpp | 2 ++
modules/gui/skins2/x11/x11_factory.cpp | 40 +++++++++++++++++++++++++++-------
3 files changed, 35 insertions(+), 8 deletions(-)
diff --git a/modules/gui/skins2/x11/x11_display.cpp b/modules/gui/skins2/x11/x11_display.cpp
index 4dc86cb861..1399ba5951 100644
--- a/modules/gui/skins2/x11/x11_display.cpp
+++ b/modules/gui/skins2/x11/x11_display.cpp
@@ -341,6 +341,7 @@ void X11Display::testEWMH()
TEST_EWMH( m_net_wm_window_opacity, "_NET_WM_WINDOW_OPACITY" )
TEST_EWMH( m_net_wm_pid, "_NET_WM_PID" )
+ TEST_EWMH( m_net_workarea, "_NET_WORKAREA" )
#undef TEST_EWMH
diff --git a/modules/gui/skins2/x11/x11_display.hpp b/modules/gui/skins2/x11/x11_display.hpp
index dea86e2a89..64f1409534 100644
--- a/modules/gui/skins2/x11/x11_display.hpp
+++ b/modules/gui/skins2/x11/x11_display.hpp
@@ -46,6 +46,7 @@
#define NET_WM_WINDOW_OPACITY m_rDisplay.m_net_wm_window_opacity
#define NET_WM_PID m_rDisplay.m_net_wm_pid
+#define NET_WORKAREA m_rDisplay.m_net_workarea
/// Class for encapsulation of a X11 Display
class X11Display: public SkinObject
@@ -99,6 +100,7 @@ public:
Atom m_net_wm_window_opacity;
Atom m_net_wm_pid;
+ Atom m_net_workarea;
/// test EWMH capabilities
void testEWMH();
diff --git a/modules/gui/skins2/x11/x11_factory.cpp b/modules/gui/skins2/x11/x11_factory.cpp
index 008c64bddb..ed52ff1ae2 100644
--- a/modules/gui/skins2/x11/x11_factory.cpp
+++ b/modules/gui/skins2/x11/x11_factory.cpp
@@ -326,8 +326,32 @@ void X11Factory::getDefaultGeometry( int* p_width, int* p_height ) const
SkinsRect X11Factory::getWorkArea() const
{
- // XXX
- return SkinsRect( 0, 0, getScreenWidth(), getScreenHeight() );
+ // query Work Area if available from Window Manager
+ // otherwise, default to the whole screen
+ int x = 0, y = 0;
+ int w = getScreenWidth(), h = getScreenHeight();
+ if( m_pDisplay->m_net_workarea != None )
+ {
+ Atom ret;
+ int i_format;
+ unsigned long i_items, i_bytesafter;
+ long *values;
+ if( XGetWindowProperty( m_pDisplay->getDisplay(),
+ DefaultRootWindow( m_pDisplay->getDisplay() ),
+ m_pDisplay->m_net_workarea,
+ 0, 16384, False, XA_CARDINAL,
+ &ret, &i_format, &i_items, &i_bytesafter,
+ (unsigned char **)&values ) == Success )
+ {
+ x = values[0];
+ y = values[1];
+ w = values[2];
+ h = values[3];
+ XFree( values );
+ }
+ }
+ msg_Dbg( getIntf(),"WorkArea: %ix%i at +%i+%i", w, h, x, y );
+ return SkinsRect( x, y, w, h );
}
@@ -391,17 +415,17 @@ void X11Factory::initCursors( )
Display *display = m_pDisplay->getDisplay();
static const struct {
CursorType_t type;
- const char *name;
+ const char *name;
} cursors[] = {
{ kDefaultArrow, "left_ptr" },
- { kResizeNWSE, "bottom_right_corner" },
- { kResizeNS, "bottom_side" },
- { kResizeWE, "right_side" },
- { kResizeNESW, "bottom_left_corner" },
+ { kResizeNWSE, "bottom_right_corner" },
+ { kResizeNS, "bottom_side" },
+ { kResizeWE, "right_side" },
+ { kResizeNESW, "bottom_left_corner" },
};
// retrieve cursors from default theme
for( unsigned i = 0; i < sizeof(cursors) / sizeof(cursors[0]); i++ )
- mCursors[cursors[i].type] =
+ mCursors[cursors[i].type] =
XcursorLibraryLoadCursor( display, cursors[i].name );
// build an additional empty cursor
More information about the vlc-commits
mailing list