2013-03-15 13:11:33 +00:00
|
|
|
namespace phoenix {
|
|
|
|
|
2012-01-15 08:29:57 +00:00
|
|
|
Size pDesktop::size() {
|
|
|
|
return {
|
|
|
|
gdk_screen_get_width(gdk_screen_get_default()),
|
|
|
|
gdk_screen_get_height(gdk_screen_get_default())
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
Geometry pDesktop::workspace() {
|
2013-05-02 11:25:45 +00:00
|
|
|
XlibDisplay* display = XOpenDisplay(nullptr);
|
2012-01-15 08:29:57 +00:00
|
|
|
int screen = DefaultScreen(display);
|
|
|
|
|
|
|
|
static Atom atom = XlibNone;
|
|
|
|
if(atom == XlibNone) atom = XInternAtom(display, "_NET_WORKAREA", True);
|
|
|
|
|
|
|
|
int format;
|
2013-05-02 11:25:45 +00:00
|
|
|
unsigned char* data = nullptr;
|
2012-01-15 08:29:57 +00:00
|
|
|
unsigned long items, after;
|
|
|
|
Atom returnAtom;
|
|
|
|
|
|
|
|
int result = XGetWindowProperty(
|
|
|
|
display, RootWindow(display, screen), atom, 0, 4, False, XA_CARDINAL, &returnAtom, &format, &items, &after, &data
|
|
|
|
);
|
|
|
|
|
|
|
|
XCloseDisplay(display);
|
|
|
|
|
|
|
|
if(result == Success && returnAtom == XA_CARDINAL && format == 32 && items == 4) {
|
|
|
|
unsigned long *workarea = (unsigned long*)data;
|
2013-05-02 11:25:45 +00:00
|
|
|
return {(signed)workarea[0], (signed)workarea[1], (unsigned)workarea[2], (unsigned)workarea[3]};
|
2012-01-15 08:29:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
0, 0,
|
|
|
|
gdk_screen_get_width(gdk_screen_get_default()),
|
|
|
|
gdk_screen_get_height(gdk_screen_get_default())
|
|
|
|
};
|
|
|
|
}
|
2013-03-15 13:11:33 +00:00
|
|
|
|
|
|
|
}
|