#include "Application.h"
#include <X11/Xlib.h>
#include <X11/Xos.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
quint32 Application::currentDesktopNumber()
{
Display* lDisplay = XOpenDisplay(nullptr);
int lScreen = DefaultScreen(lDisplay);
Window lRootWindow = RootWindow(lDisplay, lScreen);
Atom lAtom(XInternAtom(lDisplay, "_NET_CURRENT_DESKTOP", True));
if(lAtom == None)
qFatal("no atom\n");
unsigned long nitems, leftover;
unsigned char* lData = nullptr;
int actual_format;
Atom actual_type;
// if(XGetWindowProperty(lDisplay, lRootWindow, lAtom, 0L, 8, False, AnyPropertyType, nullptr, nullptr, nullptr, nullptr, &lData) != Success)
if(XGetWindowProperty(lDisplay, lRootWindow, lAtom, 0L, 8, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &leftover, &lData) != Success)
qFatal("XGetWindowProperty failed!");
quint32 lResult = lData[0];
delete [] lData;
return lResult;
}
void Application::raiseAnotherInstance(quint32 /*aProcesId*/)
{
}
#include "Application.h"
#include <X11/Xlib.h>
#include <X11/Xos.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
quint32 Application::currentDesktopNumber()
{
Display* lDisplay = XOpenDisplay(nullptr);
int lScreen = DefaultScreen(lDisplay);
Window lRootWindow = RootWindow(lDisplay, lScreen);
Atom lAtom(XInternAtom(lDisplay, "_NET_CURRENT_DESKTOP", True));
if(lAtom == None)
qFatal("no atom\n");
unsigned long nitems, leftover;
unsigned char* lData = nullptr;
int actual_format;
Atom actual_type;
// if(XGetWindowProperty(lDisplay, lRootWindow, lAtom, 0L, 8, False, AnyPropertyType, nullptr, nullptr, nullptr, nullptr, &lData) != Success)
if(XGetWindowProperty(lDisplay, lRootWindow, lAtom, 0L, 8, False, AnyPropertyType, &actual_type, &actual_format, &nitems, &leftover, &lData) != Success)
qFatal("XGetWindowProperty failed!");
quint32 lResult = lData[0];
delete [] lData;
return lResult;
}
void Application::raiseAnotherInstance(quint32 /*aProcesId*/)
{
}
To copy to clipboard, switch view to plain text mode
Solution inspired by:
Bookmarks