Enlightenment CVS committal

Author  : codewarrior
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_evas


Modified Files:
        ecore_evas_x.c 


Log Message:
- if something other than ecore_evas changes some of the states of the 
x_window, we need to listen to the changes and update our local flags (like 
sticky for example). If we dont, things like ecore_evas_sticky_get will always 
return an outdated sticky property. I have implemented it for the sticky bit 
for now, but this needs to be done for all the others as well. 

- question: do we want to implement ecore_evas_callback_sticky_set or something 
similar that will tell the programmer when the sticky bit has changed? I think 
it would be a good idea to do it here as opposed to doing it inside Etk for 
example.


===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_evas/ecore_evas_x.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -3 -r1.81 -r1.82
--- ecore_evas_x.c      20 Jul 2006 17:12:30 -0000      1.81
+++ ecore_evas_x.c      27 Jul 2006 02:42:41 -0000      1.82
@@ -8,6 +8,7 @@
 #include "Ecore_Evas.h"
 #ifdef BUILD_ECORE_X
 #include "Ecore_X.h"
+#include "Ecore_X_Atoms.h"
 #endif
 
 #ifdef BUILD_ECORE_X
@@ -17,7 +18,7 @@
 
 static Ecore_Evas *ecore_evases = NULL;
 static Evas_Hash *ecore_evases_hash = NULL;
-static Ecore_Event_Handler *ecore_evas_event_handlers[16];
+static Ecore_Event_Handler *ecore_evas_event_handlers[17];
 static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL;
 
 #ifdef BUILD_ECORE_EVAS_GL
@@ -532,6 +533,43 @@
    return 1;
 }
 
+/* TODO: we need to make this work for all the states, not just sticky */
+static int
+_ecore_evas_x_event_property_change(void *data __UNUSED__, int type 
__UNUSED__, void *event)
+{
+   Ecore_Evas *ee;
+   Ecore_X_Event_Window_Property *e;   
+
+   e = event;
+   ee = _ecore_evas_x_match(e->win);
+   if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */   
+   if (e->win != ee->engine.x.win) return 1;
+   if (e->atom == ECORE_X_ATOM_NET_WM_STATE)
+     {
+       unsigned int i, num;
+       Ecore_X_Window_State *state;
+       
+       ee->prop.sticky = 0;
+       ee->engine.x.state.sticky = 0;
+               
+       ecore_x_netwm_window_state_get(e->win, &state, &num);
+       if (state)
+         {
+            for (i = 0; i < num; i++)
+              {
+                 switch (state[i])
+                   {
+                    case ECORE_X_WINDOW_STATE_STICKY:
+                      ee->prop.sticky = 1;
+                      ee->engine.x.state.sticky = 1;                  
+                      break;
+                   }
+              }
+         }
+     }                
+   return 1;
+}
+
 static int
 _ecore_evas_x_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, 
void *event)
 {
@@ -1056,6 +1094,7 @@
    ecore_evas_event_handlers[13] = 
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, 
_ecore_evas_x_event_window_show, NULL);
    ecore_evas_event_handlers[14] = 
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_HIDE, 
_ecore_evas_x_event_window_hide, NULL);
    ecore_evas_event_handlers[15] = 
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_WHEEL, 
_ecore_evas_x_event_mouse_wheel, NULL);
+   ecore_evas_event_handlers[16] = 
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, 
_ecore_evas_x_event_property_change, NULL);
    if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
    return _ecore_evas_init_count;
 }



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to