Commit cc075868 authored by Erwan Tulou's avatar Erwan Tulou

skins(x11): query WorkArea when available

parent ba2b7b8a
......@@ -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
......
......@@ -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();
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment