add support for new netwm csd X atoms
authorMike Blumenkrantz <zmike@osg.samsung.com>
Sat, 3 Jan 2015 05:42:42 +0000 (00:42 -0500)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Sat, 3 Jan 2015 05:42:42 +0000 (00:42 -0500)
nothing uses these yet so there's no way to test them.

fix T1963

netwm.txt
src/bin/e_comp_x.c
src/bin/e_hints.c
src/bin/e_hints.h

index 0bf77e7..5467744 100644 (file)
--- a/netwm.txt
+++ b/netwm.txt
@@ -90,3 +90,7 @@ _NET_FRAME_EXTENTS                  [X]
 _NET_WM_PING                        [X]
 _NET_WM_SYNC_REQUEST                [X]
 _NET_WM_SYNC_REQUEST_COUNTER        [X]
+
+/* Random */
+_NET_WM_SHOW_WINDOW_MENU            [X]
+_NET_WM_PERFORM_BUTTON_ACTION       [X]
index 7cdf1aa..c147497 100644 (file)
@@ -1945,6 +1945,57 @@ _e_comp_x_message(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_X_Event_Cl
              free(p);
           }
      }
+   else if (ev->message_type == ATM_NETWM_SHOW_WINDOW_MENU)
+     {
+       /*
+         message_type = _NET_WM_SHOW_WINDOW_MENU
+         window = window for which the menu should be shown
+         format = 32
+         data.l[0] = xinput2_device_id
+         data.l[1] = root_x
+         data.l[2] = root_y
+         other data.l[] elements = 0
+        */
+
+        int x, y;
+
+        x = ev->data.l[1];
+        y = ev->data.l[2];
+        e_int_client_menu_show(ec,
+          e_comp_canvas_x_root_adjust(ec->comp, x),
+          e_comp_canvas_y_root_adjust(ec->comp, y),
+          0, 0);
+     }
+   else if (ev->message_type == ATM_NETWM_PERFORM_BUTTON_ACTION)
+     {
+        char emission[128];
+       /*
+         message_type = _NET_WM_PERFORM_BUTTON_ACTION
+         window = window for which the action should be performed
+         format = 32
+         data.l[0] = xinput2_device_id
+         data.l[1] = root_x
+         data.l[2] = root_y
+         data.l[3] = button
+         data.l[4] = timestamp
+        */
+        if (e_dnd_active() || ec->iconic) return ECORE_CALLBACK_RENEW;
+        switch (ev->data.l[3])
+          {
+           case 1:
+           case 2:
+           case 3:
+             snprintf(emission, sizeof(emission), "mouse,down,%d", (int)ev->data.l[3]);
+             e_bindings_signal_handle(E_BINDING_CONTEXT_WINDOW, E_OBJECT(ec), emission, "e.event.titlebar");
+             break;
+           case 4:
+             e_bindings_signal_handle(E_BINDING_CONTEXT_WINDOW, E_OBJECT(ec), "mouse,wheel,?,-1", "e.event.titlebar");
+             break;
+           case 5:
+             e_bindings_signal_handle(E_BINDING_CONTEXT_WINDOW, E_OBJECT(ec), "mouse,wheel,?,1", "e.event.titlebar");
+             break;
+          }
+     }
    return ECORE_CALLBACK_PASS_ON;
 }
 
index 7b8cd09..cc6d25a 100644 (file)
@@ -13,6 +13,9 @@ EAPI Ecore_X_Atom ATM_GNOME_SM_PROXY = 0;
 EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_COMMS = 0;
 EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_VERSION = 0;
 EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_SCALE = 0;
+
+EAPI Ecore_X_Atom ATM_NETWM_SHOW_WINDOW_MENU = 0;
+EAPI Ecore_X_Atom ATM_NETWM_PERFORM_BUTTON_ACTION = 0;
 #endif
 
 EINTERN void
@@ -26,23 +29,27 @@ e_hints_init(Ecore_Window root, Ecore_Window propwin)
       "GNOME_SM_PROXY",
       "ENLIGHTENMENT_COMMS",
       "ENLIGHTENMENT_VERSION",
-      "ENLIGHTENMENT_SCALE"
+      "ENLIGHTENMENT_SCALE",
+      "_NET_WM_SHOW_WINDOW_MENU",
+      "_NET_WM_PERFORM_BUTTON_ACTION",
    };
-   Ecore_X_Atom atoms[6];
-   Ecore_X_Atom supported[43];
+   Ecore_X_Atom atoms[EINA_C_ARRAY_LENGTH(atom_names)];
+   Ecore_X_Atom supported[45];
    int supported_num;
    Ecore_X_Window win, twin;
    int nwins;
    char *name;
    double ts;
 
-   ecore_x_atoms_get(atom_names, 6, atoms);
+   ecore_x_atoms_get(atom_names, EINA_C_ARRAY_LENGTH(atom_names), atoms);
    ATM__QTOPIA_SOFT_MENU = atoms[0];
    ATM__QTOPIA_SOFT_MENUS = atoms[1];
    ATM_GNOME_SM_PROXY = atoms[2];
    ATM_ENLIGHTENMENT_COMMS = atoms[3];
    ATM_ENLIGHTENMENT_VERSION = atoms[4];
    ATM_ENLIGHTENMENT_SCALE = atoms[5];
+   ATM_NETWM_SHOW_WINDOW_MENU = atoms[6];
+   ATM_NETWM_PERFORM_BUTTON_ACTION = atoms[7];
 
    supported_num = 0;
    /* Set what hints we support */
@@ -121,6 +128,9 @@ e_hints_init(Ecore_Window root, Ecore_Window propwin)
    supported[supported_num++] = ECORE_X_ATOM_E_VIDEO_PARENT;
    supported[supported_num++] = ECORE_X_ATOM_E_VIDEO_POSITION;
 
+   supported[supported_num++] = ATM_NETWM_SHOW_WINDOW_MENU;
+   supported[supported_num++] = ATM_NETWM_PERFORM_BUTTON_ACTION;
+
 
 
 
index 2609954..a0c5f9a 100644 (file)
@@ -55,6 +55,8 @@ extern EAPI Ecore_X_Atom ATM_GNOME_SM_PROXY;
 extern EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_COMMS;
 extern EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_VERSION;
 extern EAPI Ecore_X_Atom ATM_ENLIGHTENMENT_SCALE;
+extern EAPI Ecore_X_Atom ATM_NETWM_SHOW_WINDOW_MENU;
+extern EAPI Ecore_X_Atom ATM_NETWM_PERFORM_BUTTON_ACTION;
 #endif
 #endif
 #endif