aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libLumina/LuminaX11.cpp131
-rw-r--r--libLumina/LuminaX11.h42
-rw-r--r--lumina-desktop/LSession.cpp15
3 files changed, 179 insertions, 9 deletions
diff --git a/libLumina/LuminaX11.cpp b/libLumina/LuminaX11.cpp
index 392d22db..f5aab49f 100644
--- a/libLumina/LuminaX11.cpp
+++ b/libLumina/LuminaX11.cpp
@@ -50,6 +50,36 @@ LXCB::~LXCB(){
xcb_ewmh_connection_wipe(&EWMH);
}
+// private function
+void LXCB::createWMAtoms(){
+ ATOMS.clear();
+ atoms.clear();
+ //List the atoms needed by some WM functions
+ atoms << "WM_TAKE_FOCUS" << "WM_DELETE_WINDOW"; //WM_PROTOCOLS
+
+ //Create all the requests for the atoms
+ QList<xcb_intern_atom_reply_t*> reply;
+ for(int i=0; i<atoms.length(); i++){
+ reply << xcb_intern_atom_reply(QX11Info::connection(), \
+ xcb_intern_atom(QX11Info::connection(), 0, atoms[i].length(), atoms[i].toLocal8Bit()), NULL);
+ }
+ //Now evaluate all the requests and save the atoms
+ for(int i=0; i<reply.length(); i++){
+ if(reply[i]!=0){
+ ATOMS << reply[i]->atom;
+ free(reply[i]); //done with this reply
+ }else{
+ //Invalid atom - could not be created
+ atoms.removeAt(i);
+ reply.removeAt(i);
+ i--;
+ }
+ }
+
+
+
+}
+
// === WindowList() ===
QList<WId> LXCB::WindowList(bool rawlist){
if(DEBUG){ qDebug() << "XCB: WindowList()" << rawlist; }
@@ -1080,4 +1110,105 @@ void LXCB::closeSystemTray(WId trayID){
void LXCB::WM_CloseWindow(WId win){
xcb_destroy_window(QX11Info::connection(), win);
}
+
+// --------------------------------------------------
+// ICCCM Standards (older standards)
+// --------------------------------------------------
+// -- WM_NAME
+QString LXCB::WM_ICCCM_GetName(WId win){
+ xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_name_unchecked(QX11Info::connection(), win);
+ xcb_icccm_get_text_property_reply_t reply;
+ if(1 != xcb_icccm_get_wm_name_reply(QX11Info::connection(), cookie, &reply, NULL) ){
+ return ""; //error in fetching name
+ }else{
+ return QString::fromLocal8Bit(reply.name);
+ }
+}
+
+void LXCB::WM_ICCCM_SetName(WId win, QString name){
+ xcb_icccm_set_wm_name(QX11Info::connection(), win, XCB_ATOM_STRING, 8, name.length(), name.toLocal8Bit());
+}
+
+// -- WM_ICON_NAME
+QString LXCB::WM_ICCCM_GetIconName(WId win){
+ xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_icon_name_unchecked(QX11Info::connection(), win);
+ xcb_icccm_get_text_property_reply_t reply;
+ if(1 != xcb_icccm_get_wm_icon_name_reply(QX11Info::connection(), cookie, &reply, NULL) ){
+ return ""; //error in fetching name
+ }else{
+ return QString::fromLocal8Bit(reply.name);
+ }
+}
+
+void LXCB::WM_ICCCM_SetIconName(WId win, QString name){
+ xcb_icccm_set_wm_icon_name(QX11Info::connection(), win, XCB_ATOM_STRING, 8, name.length(), name.toLocal8Bit());
+}
+
+// -- WM_CLIENT_MACHINE
+QString LXCB::WM_ICCCM_GetClientMachine(WId win){
+ xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_client_machine_unchecked(QX11Info::connection(), win);
+ xcb_icccm_get_text_property_reply_t reply;
+ if(1 != xcb_icccm_get_wm_client_machine_reply(QX11Info::connection(), cookie, &reply, NULL) ){
+ return ""; //error in fetching name
+ }else{
+ return QString::fromLocal8Bit(reply.name);
+ }
+}
+
+void LXCB::WM_ICCCM_SetClientMachine(WId win, QString name){
+ xcb_icccm_set_wm_client_machine(QX11Info::connection(), win, XCB_ATOM_STRING, 8, name.length(), name.toLocal8Bit());
+}
+
+// -- WM_CLASS
+QString LXCB::WM_ICCCM_GetClass(WId win){
+ xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_class_unchecked(QX11Info::connection(), win);
+ xcb_icccm_get_wm_class_reply_t reply;
+ if(1 != xcb_icccm_get_wm_class_reply(QX11Info::connection(), cookie, &reply, NULL) ){
+ return ""; //error in fetching name
+ }else{
+ //Returns: "<instance name>::::<class name>"
+ return ( QString::fromLocal8Bit(reply.instance_name)+"::::"+QString::fromLocal8Bit(reply.class_name) );
+ }
+}
+
+void LXCB::WM_ICCCM_SetClass(WId win, QString name){
+ xcb_icccm_set_wm_class(QX11Info::connection(), win, name.length(), name.toLocal8Bit());
+}
+
+// -- WM_TRANSIENT_FOR
+WId WM_ICCCM_GetTransientFor(WId win){
+ xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_transient_for_unchecked(QX11Info::connection(), win);
+ xcb_window_t trans;
+ if(1!= xcb_icccm_get_wm_transient_for_reply(QX11Info::connection(), cookie, &trans, NULL) ){
+ return win; //error in fetching transient window ID (or none found)
+ }else{
+ return trans;
+ }
+}
+
+void WM_ICCCM_SetTransientFor(WId win, WId transient){
+ xcb_icccm_set_wm_transient_for(QX11Info::connection(), win, transient);
+}
+
+// -- WM_SIZE_HINTS
+
+// -- WM_NORMAL_HINTS
+
+// -- WM_HINTS
+// -- WM_PROTOCOLS
+
+// --------------------------------------------------------
+// NET_WM Standards (newer standards)
+// --------------------------------------------------------
+void LXCB::WM_Set_Root_Supported(){
+ //NET_WM standards (ICCCM implied - no standard way to list those)
+ xcb_atom_t list[] = {};
+ xcb_ewmh_set_supported(&EWMH, QX11Info::appScreen(), 0,list);
+}
+
+void LXCB::WM_Set_Window_Supported(WId win){
+ //NET_WM standards (ICCCM implied - no standard way to list those)
+ xcb_atom_t list[] = {};
+ xcb_ewmh_set_wm_allowed_actions(&EWMH, win, 0, list);
+} \ No newline at end of file
diff --git a/libLumina/LuminaX11.h b/libLumina/LuminaX11.h
index 4c791abd..b6431fc6 100644
--- a/libLumina/LuminaX11.h
+++ b/libLumina/LuminaX11.h
@@ -50,12 +50,14 @@ class LXCB{
public:
enum WINDOWSTATE {IGNORE, INVISIBLE, VISIBLE, ACTIVE, ATTENTION}; //note that this in order of priority
-
+ enum ICCCM_STATE {WITHDRAWN, NORMAL, ICONIC};
+ enum ICCCM_PROTOCOLS {TAKE_FOCUS, DELETE_WINDOW};
+
xcb_ewmh_connection_t EWMH; //This is where all the screen info and atoms are located
-
+
LXCB();
~LXCB();
-
+
//== Main Interface functions ==
// General Information
QList<WId> WindowList(bool rawlist = false); //list all non-Lumina windows (rawlist -> all workspaces)
@@ -122,6 +124,40 @@ public:
//============
void WM_CloseWindow(WId win);
+ // ICCCM Standards (older standards)
+ // -- WM_NAME
+ QString WM_ICCCM_GetName(WId win);
+ void WM_ICCCM_SetName(WId win, QString name);
+ // -- WM_ICON_NAME
+ QString WM_ICCCM_GetIconName(WId win);
+ void WM_ICCCM_SetIconName(WId win, QString name);
+ // --- WM_CLIENT_MACHINE
+ QString WM_ICCCM_GetClientMachine(WId win);
+ void WM_ICCCM_SetClientMachine(WId win, QString name);
+ // -- WM_CLASS
+ QString WM_ICCCM_GetClass(WId win); //Returns: "<instance name>::::<class name>"
+ void WM_ICCCM_SetClass(WId win, QString name);
+ // -- WM_TRANSIENT_FOR
+ WId WM_ICCCM_GetTransientFor(WId win); //Returns "win" for errors or no transient
+ void WM_ICCCM_SetTransientFor(WId win, WId transient);
+ // -- WM_SIZE_HINTS
+
+ // -- WM_NORMAL_HINTS
+
+ // -- WM_HINTS
+
+ // -- WM_PROTOCOLS
+
+
+ //NET_WM Standards (newer standards)
+ void WM_Set_Root_Supported(); //set the atom list of supported features on the root window
+ void WM_Set_Window_Supported(WId win); //set the atom list of supported features on the given window
+
+private:
+ QList<xcb_atom_t> ATOMS;
+ QStringList atoms;
+
+ void createWMAtoms(); //fill the private lists above
};
#endif \ No newline at end of file
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp
index 2190d445..61c01175 100644
--- a/lumina-desktop/LSession.cpp
+++ b/lumina-desktop/LSession.cpp
@@ -45,7 +45,7 @@ LSession::LSession(int &argc, char ** argv) : QApplication(argc, argv){
TrayStopping = false;
screenTimer = new QTimer(this);
screenTimer->setSingleShot(true);
- screenTimer->setInterval(2000); //0.2 seconds
+ screenTimer->setInterval(200); //0.2 seconds
connect(screenTimer, SIGNAL(timeout()), this, SLOT(updateDesktops()) );
for(int i=1; i<argc; i++){
if( QString::fromLocal8Bit(argv[i]) == "--noclean" ){ cleansession = false; break; }
@@ -346,16 +346,19 @@ void LSession::watcherChange(QString changed){
void LSession::screensChanged(){
qDebug() << "Screen Number Changed";
- //if(screenTimer->isActive()){ screenTimer->stop(); }
- //screenTimer->start();
- updateDesktops();
+ if(screenTimer->isActive()){ screenTimer->stop(); }
+ screenTimer->start();
+ //updateDesktops();
}
void LSession::screenResized(int scrn){
qDebug() << "Screen Resized:" << scrn << this->desktop()->screenGeometry(scrn);
- for(int i=0; i<DESKTOPS.length(); i++){
+ /*for(int i=0; i<DESKTOPS.length(); i++){
if(DESKTOPS[i]->Screen() == scrn){ DESKTOPS[i]->UpdateGeometry(); return; }
- }
+ }*/
+ if(screenTimer->isActive()){ screenTimer->stop(); }
+ screenTimer->start();
+ //updateDesktops();
}
void LSession::checkWindowGeoms(){
bgstack15