Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_border.c e_border.h e_config.c e_config.h e_focus.c 
        e_focus.h e_ipc.c e_remote_main.c 


Log Message:


click to focus works... if you turn it on and restart. 

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.217
retrieving revision 1.218
diff -u -3 -r1.217 -r1.218
--- e_border.c  20 May 2005 07:32:42 -0000      1.217
+++ e_border.c  20 May 2005 09:27:05 -0000      1.218
@@ -219,6 +219,7 @@
    bd->win = ecore_x_window_override_new(con->win, 0, 0, bd->w, bd->h);
    ecore_x_window_shape_events_select(bd->win, 1);
    e_bindings_mouse_grab(E_BINDING_CONTEXT_BORDER, bd->win);
+   e_focus_setup(bd);
    if (e_canvas_engine_decide(e_config->evas_engine_borders) ==
        E_EVAS_ENGINE_GL_X11)
      {
@@ -673,9 +674,15 @@
    if (!bd->client.icccm.accepts_focus) return;
 //   printf("flag focus to %i\n", focus);
    if ((focus) && (!bd->focused))
-     edje_object_signal_emit(bd->bg_object, "active", "");
+     {
+       edje_object_signal_emit(bd->bg_object, "active", "");
+       e_focus_event_focus_in(bd);
+     }
    else if ((!focus) && (bd->focused))
-     edje_object_signal_emit(bd->bg_object, "passive", "");
+     {
+       edje_object_signal_emit(bd->bg_object, "passive", "");
+       e_focus_event_focus_out(bd);
+     }
    bd->focused = focus;
    if (set)
      {
@@ -1445,6 +1452,7 @@
    e_canvas_del(bd->bg_ecore_evas);
    ecore_evas_free(bd->bg_ecore_evas);
    ecore_x_window_del(bd->client.shell_win);
+   e_focus_setdown(bd);
    e_bindings_mouse_ungrab(E_BINDING_CONTEXT_BORDER, bd->win);
    ecore_x_window_del(bd->win);
 
@@ -2423,26 +2431,25 @@
    bd = data;
    if (ev->event_win == bd->win)
      {
-       if(!e_focus_event_mouse_down(bd))
+       if ((ev->button >= 1) && (ev->button <= 3))
          {
-            if ((ev->button >= 1) && (ev->button <= 3))
-              {
-                 bd->mouse.last_down[ev->button - 1].mx = ev->root.x;
-                 bd->mouse.last_down[ev->button - 1].my = ev->root.y;
-                 bd->mouse.last_down[ev->button - 1].x = bd->x;
-                 bd->mouse.last_down[ev->button - 1].y = bd->y;
-                 bd->mouse.last_down[ev->button - 1].w = bd->w;
-                 bd->mouse.last_down[ev->button - 1].h = bd->h;
-              }
-            bd->mouse.current.mx = ev->root.x;
-            bd->mouse.current.my = ev->root.y;
-            if (!bd->cur_mouse_action)
-              {
-                 bd->cur_mouse_action = 
-                    
e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_BORDER,
-                          E_OBJECT(bd), ev);
-              }
+            bd->mouse.last_down[ev->button - 1].mx = ev->root.x;
+            bd->mouse.last_down[ev->button - 1].my = ev->root.y;
+            bd->mouse.last_down[ev->button - 1].x = bd->x;
+            bd->mouse.last_down[ev->button - 1].y = bd->y;
+            bd->mouse.last_down[ev->button - 1].w = bd->w;
+            bd->mouse.last_down[ev->button - 1].h = bd->h;
+         }
+       bd->mouse.current.mx = ev->root.x;
+       bd->mouse.current.my = ev->root.y;
+       if (!bd->cur_mouse_action)
+         {
+            bd->cur_mouse_action = 
+              e_bindings_mouse_down_event_handle(E_BINDING_CONTEXT_BORDER,
+                                                 E_OBJECT(bd), ev);
          }
+       if (!bd->cur_mouse_action)
+         e_focus_event_mouse_down(bd);
      }
    if (ev->win != bd->event_win) return 1;
    if ((ev->button >= 1) && (ev->button <= 3))
@@ -2484,31 +2491,31 @@
    bd = data;
    if (ev->event_win == bd->win)
      {
-       if(!e_focus_event_mouse_up(bd))
+       if ((ev->button >= 1) && (ev->button <= 3))
          {
-            if ((ev->button >= 1) && (ev->button <= 3))
-              {
-                 bd->mouse.last_up[ev->button - 1].mx = ev->root.x;
-                 bd->mouse.last_up[ev->button - 1].my = ev->root.y;
-                 bd->mouse.last_up[ev->button - 1].x = bd->x;
-                 bd->mouse.last_up[ev->button - 1].y = bd->y;
-              }
-            bd->mouse.current.mx = ev->root.x;
-            bd->mouse.current.my = ev->root.y;
-            /* bug/problem. this action COULD be deleted during a move */
-            /* ... VERY unlikely though... VERY */
-            /* also we dont pass the same params that went in - then again 
that */
-            /* should be ok as we are just ending the action if it has an end 
*/
-            if (bd->cur_mouse_action)
-              {
-                 if (bd->cur_mouse_action->func.end_mouse)
-                   bd->cur_mouse_action->func.end_mouse(E_OBJECT(bd), "", ev);
-                 else if (bd->cur_mouse_action->func.end)
-                   bd->cur_mouse_action->func.end(E_OBJECT(bd), "");
-                 bd->cur_mouse_action = NULL;
-              }
-            else
-              e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_BORDER, 
E_OBJECT(bd), ev);
+            bd->mouse.last_up[ev->button - 1].mx = ev->root.x;
+            bd->mouse.last_up[ev->button - 1].my = ev->root.y;
+            bd->mouse.last_up[ev->button - 1].x = bd->x;
+            bd->mouse.last_up[ev->button - 1].y = bd->y;
+         }
+       bd->mouse.current.mx = ev->root.x;
+       bd->mouse.current.my = ev->root.y;
+       /* bug/problem. this action COULD be deleted during a move */
+       /* ... VERY unlikely though... VERY */
+       /* also we dont pass the same params that went in - then again that */
+       /* should be ok as we are just ending the action if it has an end */
+       if (bd->cur_mouse_action)
+         {
+            if (bd->cur_mouse_action->func.end_mouse)
+              bd->cur_mouse_action->func.end_mouse(E_OBJECT(bd), "", ev);
+            else if (bd->cur_mouse_action->func.end)
+              bd->cur_mouse_action->func.end(E_OBJECT(bd), "");
+            bd->cur_mouse_action = NULL;
+         }
+       else
+         {
+            if (!e_bindings_mouse_up_event_handle(E_BINDING_CONTEXT_BORDER, 
E_OBJECT(bd), ev))
+              e_focus_event_mouse_up(bd);
          }
      }
    if (ev->win != bd->event_win) return 1;
@@ -2652,12 +2659,14 @@
    if (type == ECORE_X_EVENT_MOUSE_BUTTON_DOWN)
      {
        Ecore_X_Event_Mouse_Button_Down *e;
-       E_Border *bd;
 
        e = event;
-       bd = e_border_find_by_client_window(e->win);
-       if (!bd) bd = e_border_find_by_client_window(e->event_win);
-       /* FIXME: return 1 if we pass this click on... */
+       if ((e_config->pass_click_on) ||
+           (e_config->always_click_to_raise))
+         {
+            printf("ALLOW PRESS\n");
+            return 1;
+         }
      }
    return 0;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- e_border.h  20 May 2005 07:32:42 -0000      1.57
+++ e_border.h  20 May 2005 09:27:05 -0000      1.58
@@ -28,8 +28,8 @@
 
 typedef enum _E_Focus_Policy
 {
-   E_FOCUS_FOLLOW_MOUSE = 1 << 0,
-   E_FOCUS_AUTORAISE = 1 << 1
+   E_FOCUS_CLICK = 0,
+   E_FOCUS_MOUSE = 1
 } E_Focus_Policy;
 
 
@@ -194,6 +194,7 @@
    unsigned char   fullscreen : 1;
    unsigned char   already_unparented : 1;
    unsigned char   need_reparent : 1;
+   unsigned char   button_grabbed : 1;
  
    unsigned char   changed : 1;
    
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_config.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -3 -r1.51 -r1.52
--- e_config.c  20 May 2005 07:32:42 -0000      1.51
+++ e_config.c  20 May 2005 09:27:05 -0000      1.52
@@ -139,6 +139,11 @@
    E_CONFIG_LIST(D, T, path_append_icons, _e_config_path_append_edd); /**/
    E_CONFIG_LIST(D, T, path_append_modules, _e_config_path_append_edd); /**/
    E_CONFIG_LIST(D, T, path_append_backgrounds, _e_config_path_append_edd); 
/**/
+   E_CONFIG_VAL(D, T, focus_policy, INT); /**/
+   E_CONFIG_VAL(D, T, pass_click_on, INT);
+   E_CONFIG_VAL(D, T, always_click_to_raise, INT);
+   E_CONFIG_VAL(D, T, use_auto_raise, INT);
+   E_CONFIG_VAL(D, T, auto_raise_delay, DOUBLE); 
 
    e_config = e_config_domain_load("e", _e_config_edd);
    if (e_config)
@@ -200,8 +205,11 @@
        e_config->evas_engine_popups = E_EVAS_ENGINE_DEFAULT;
        e_config->evas_engine_drag = E_EVAS_ENGINE_DEFAULT;
        e_config->language = strdup("");
-       e_config->focus_policy = E_FOCUS_FOLLOW_MOUSE;
-       e_config->raise_timer = 0;
+       e_config->focus_policy = E_FOCUS_MOUSE;
+       e_config->pass_click_on = 1;
+       e_config->always_click_to_raise = 1;
+       e_config->use_auto_raise = 0;
+       e_config->auto_raise_delay = 0.5;
          {
             E_Config_Module *em;
 
@@ -662,6 +670,7 @@
        e_config_save_queue();
      }
 //   e_config->evas_engine_container = E_EVAS_ENGINE_GL_X11;
+   e_config->focus_policy = E_FOCUS_MOUSE;
 
    E_CONFIG_LIMIT(e_config->menus_scroll_speed, 1.0, 20000.0);
    E_CONFIG_LIMIT(e_config->menus_fast_mouse_move_threshhold, 1.0, 2000.0);
@@ -676,6 +685,8 @@
    E_CONFIG_LIMIT(e_config->zone_desks_y_count, 1, 64);
    E_CONFIG_LIMIT(e_config->use_edge_flip, 0, 1);
    E_CONFIG_LIMIT(e_config->edge_flip_timeout, 0.0, 2.0);
+   E_CONFIG_LIMIT(e_config->use_auto_raise, 0, 1);
+   E_CONFIG_LIMIT(e_config->auto_raise_delay, 0.0, 5.0);
 
    /* apply lang config - exception because config is loaded after intl setup 
*/
    
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_config.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- e_config.h  20 May 2005 07:32:42 -0000      1.24
+++ e_config.h  20 May 2005 09:27:06 -0000      1.25
@@ -36,7 +36,6 @@
 typedef struct _E_Config_Theme          E_Config_Theme;
 typedef struct _E_Config_Binding_Mouse  E_Config_Binding_Mouse;
 typedef struct _E_Config_Binding_Key    E_Config_Binding_Key;
-typedef struct _E_Config_Focus_Policy   E_Config_Focus_Policy;
 typedef Eet_Data_Descriptor             E_Config_DD;
 
 #else
@@ -47,7 +46,7 @@
  * defaults for e to work - started at 100 when we introduced this config
  * versioning feature
  */
-#define E_CONFIG_FILE_VERSION 104
+#define E_CONFIG_FILE_VERSION 105
 
 #define E_EVAS_ENGINE_DEFAULT      0
 #define E_EVAS_ENGINE_SOFTWARE_X11 1
@@ -94,9 +93,11 @@
    Evas_List  *path_append_icons;
    Evas_List  *path_append_modules;
    Evas_List  *path_append_backgrounds;
-   E_Focus_Policy focus_policy;
-   int            raise_timer;
-   
+   int         focus_policy;
+   int         pass_click_on;
+   int         always_click_to_raise;
+   int         use_auto_raise;
+   double      auto_raise_delay;
 };
 
 struct _E_Config_Module
@@ -131,14 +132,6 @@
    unsigned char  any_mod;
 };
 
-struct _E_Config_Focus_Policy
-{
-   E_Focus_Policy focus_policy;
-   int           raise_timer;
-};
-
-
-
 EAPI int e_config_init(void);
 EAPI int e_config_shutdown(void);
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_focus.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- e_focus.c   20 May 2005 07:32:42 -0000      1.8
+++ e_focus.c   20 May 2005 09:27:06 -0000      1.9
@@ -4,35 +4,20 @@
 #include "e.h"
 
 /* local subsystem functions */
-static int _e_focus_cb_window_focus_in(void *data, int ev_type, void *ev);
-static int _e_focus_cb_window_focus_out(void *data, int ev_type, void *ev);
-static int _e_focus_cb_mouse_button_down(void *data, int ev_type, void *ev);
 static int _e_focus_raise_timer(void* data);
 
 /* local subsystem globals */
-static Ecore_Event_Handler *_e_focus_focus_in_handler = NULL;
-static Ecore_Event_Handler *_e_focus_focus_out_handler = NULL;
-static Ecore_Event_Handler *_e_focus_mouse_down_handler = NULL;
 
 /* externally accessible functions */
 int
 e_focus_init(void)
 {
-   _e_focus_focus_in_handler = 
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, 
_e_focus_cb_window_focus_in, NULL);
-   _e_focus_focus_out_handler = 
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, 
_e_focus_cb_window_focus_out, NULL);
-//   _e_focus_mouse_down_handler = 
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_DOWN, 
-//      _e_focus_cb_mouse_button_down, NULL);
-
-
    return 1;
 }
 
 int
 e_focus_shutdown(void)
 {
-   E_FN_DEL(ecore_event_handler_del, _e_focus_focus_in_handler);
-   E_FN_DEL(ecore_event_handler_del, _e_focus_focus_out_handler);
-   E_FN_DEL(ecore_event_handler_del, _e_focus_mouse_down_handler);
    return 1;
 }
 
@@ -42,174 +27,98 @@
    return;
 }
 
-int
+void
 e_focus_event_mouse_in(E_Border* bd)
 {
    /* If focus follows mouse */
-   if( e_config->focus_policy & E_FOCUS_FOLLOW_MOUSE)
+   if (e_config->focus_policy == E_FOCUS_MOUSE)
      e_border_focus_set(bd, 1, 1);
    
    bd->raise_timer = NULL;
-   if (e_config->focus_policy & E_FOCUS_AUTORAISE)
+   if (e_config->use_auto_raise)
      {
-       if (e_config->raise_timer == 0)
+       if (e_config->auto_raise_delay == 0.0)
          e_border_raise(bd);
        else
-         bd->raise_timer = ecore_timer_add((double)e_config->raise_timer / 
10.0, 
-                                           _e_focus_raise_timer, bd);
+         bd->raise_timer = ecore_timer_add(e_config->auto_raise_delay, 
_e_focus_raise_timer, bd);
      }
-   return 0;
 }
 
-int
+void
 e_focus_event_mouse_out(E_Border* bd)
 {
    /* If focus follows mouse */
-   if (e_config->focus_policy & E_FOCUS_FOLLOW_MOUSE)
+   if (e_config->focus_policy == E_FOCUS_MOUSE)
      e_border_focus_set(bd, 0, 1);
 
-   if (bd->raise_timer != NULL)
+   if (bd->raise_timer)
      {
        ecore_timer_del(bd->raise_timer);
        bd->raise_timer = NULL;
      }
-   return 0;
 }
 
-int
+void
 e_focus_event_mouse_down(E_Border* bd)
 {
-   if (!(e_config->focus_policy & E_FOCUS_FOLLOW_MOUSE))
+   if (e_config->focus_policy == E_FOCUS_CLICK)
      {
        e_border_focus_set(bd, 1, 1);
        e_border_raise(bd);
      }
-   return 0;
 }
 
-int
+void
 e_focus_event_mouse_up(E_Border* bd)
 {
-   return 0;
 }
 
-
-/* local subsystem functions */
-static int
-_e_focus_cb_window_focus_in(void *data, int ev_type, void *ev)
+void
+e_focus_event_focus_in(E_Border *bd)
 {
-   Ecore_X_Event_Window_Focus_In *e;
-
-   e = ev;
-#if 0
-   const char *modes[] = {
-       "ECORE_X_EVENT_MODE_NORMAL",
-       "ECORE_X_EVENT_MODE_WHILE_GRABBED",
-       "ECORE_X_EVENT_MODE_GRAB",
-       "ECORE_X_EVENT_MODE_UNGRAB"
-   };
-   const char *details[] = {
-       "ECORE_X_EVENT_DETAIL_ANCESTOR",
-       "ECORE_X_EVENT_DETAIL_VIRTUAL",
-       "ECORE_X_EVENT_DETAIL_INFERIOR",
-       "ECORE_X_EVENT_DETAIL_NON_LINEAR",
-       "ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL",
-       "ECORE_X_EVENT_DETAIL_POINTER",
-       "ECORE_X_EVENT_DETAIL_POINTER_ROOT",
-       "ECORE_X_EVENT_DETAIL_DETAIL_NONE"
-   };
-
-   if (e_border_find_by_client_window(e->win))
-     {
-       printf("BI 0x%x md=%s dt=%s\n",
-              e->win,
-              modes[e->mode],
-              details[e->detail]);
-     }
-   else
-     {
-       printf("FI 0x%x md=%s dt=%s\n",
-              e->win,
-              modes[e->mode],
-              details[e->detail]);
+   if ((e_config->focus_policy == E_FOCUS_CLICK) &&
+       (!e_config->always_click_to_raise))
+     {
+       if (!bd->button_grabbed) return;
+       ecore_x_window_button_ungrab(bd->win, 1, 0, 1);
+       bd->button_grabbed = 0;
      }
-#endif
-   return 1;
 }
 
-static int
-_e_focus_cb_window_focus_out(void *data, int ev_type, void *ev)
+void
+e_focus_event_focus_out(E_Border *bd)
 {
-   Ecore_X_Event_Window_Focus_Out *e;
-
-   e = ev;
-#if 0
-   const char *modes[] = {
-       "ECORE_X_EVENT_MODE_NORMAL",
-       "ECORE_X_EVENT_MODE_WHILE_GRABBED",
-       "ECORE_X_EVENT_MODE_GRAB",
-       "ECORE_X_EVENT_MODE_UNGRAB"
-   };
-   const char *details[] = {
-       "ECORE_X_EVENT_DETAIL_ANCESTOR",
-       "ECORE_X_EVENT_DETAIL_VIRTUAL",
-       "ECORE_X_EVENT_DETAIL_INFERIOR",
-       "ECORE_X_EVENT_DETAIL_NON_LINEAR",
-       "ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL",
-       "ECORE_X_EVENT_DETAIL_POINTER",
-       "ECORE_X_EVENT_DETAIL_POINTER_ROOT",
-       "ECORE_X_EVENT_DETAIL_DETAIL_NONE"
-   };
-
-   if (e_border_find_by_client_window(e->win))
-     {
-       printf("BO 0x%x md=%s dt=%s\n",
-              e->win,
-              modes[e->mode],
-              details[e->detail]);
-     }
-   else
-     {
-       printf("FO 0x%x md=%s dt=%s\n",
-              e->win,
-              modes[e->mode],
-              details[e->detail]);
+   if ((e_config->focus_policy == E_FOCUS_CLICK) &&
+       (!e_config->always_click_to_raise))
+     {
+       if (bd->button_grabbed) return;
+       ecore_x_window_button_grab(bd->win, 1, ECORE_X_EVENT_MASK_MOUSE_DOWN, 
0, 1);
+       bd->button_grabbed = 1;
      }
-#endif
-   return 1;
 }
 
-
-static int
-_e_focus_cb_mouse_button_down(void *data, int ev_type, void *ev)
+void
+e_focus_setup(E_Border *bd)
 {
-   Ecore_X_Event_Mouse_Button_Down* e;
-   E_Border* bd = NULL;
-
-   e = ev;
-
-   fprintf(stderr,"%s, %p\n",__FUNCTION__, e->win);
-
-   bd = e_border_find_by_client_window(e->win);
-   if (!bd)
-     bd = e_border_find_by_window(e->win);
-   if (!bd)
-     bd = e_border_find_by_frame_window(e->win);
-
-   if (!bd)
-     bd = e_border_find_by_client_window(e->event_win);
-   if (!bd)
-     bd = e_border_find_by_window(e->event_win);
-   if (!bd)
-     bd = e_border_find_by_frame_window(e->event_win);
+   if ((e_config->focus_policy == E_FOCUS_CLICK) ||
+       (e_config->always_click_to_raise))
+     {
+       if (bd->button_grabbed) return;
+       ecore_x_window_button_grab(bd->win, 1, ECORE_X_EVENT_MASK_MOUSE_DOWN, 
0, 1);
+       bd->button_grabbed = 1;
+     }
+}
 
-   fprintf(stderr,"bd = %p\n", bd);
+void
+e_focus_setdown(E_Border *bd)
+{
+   if (!bd->button_grabbed) return;
+   ecore_x_window_button_ungrab(bd->win, 1, 0, 1);
+   bd->button_grabbed = 0;
+}
 
-   if (bd)
-     e_focus_event_mouse_down(bd);
 
-   return 1;
-}
+/* local subsystem functions */
      
 static int
 _e_focus_raise_timer(void* data)
@@ -218,4 +127,3 @@
    ((E_Border*)data)->raise_timer = NULL;
    return 0;
 }
-
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_focus.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- e_focus.h   20 May 2005 07:32:42 -0000      1.5
+++ e_focus.h   20 May 2005 09:27:06 -0000      1.6
@@ -10,10 +10,14 @@
 EAPI int e_focus_shutdown(void);
 EAPI void e_focus_idler_before(void);
 
-EAPI int e_focus_event_mouse_in(E_Border* bd);
-EAPI int e_focus_event_mouse_out(E_Border* bd);
-EAPI int e_focus_event_mouse_down(E_Border* bd);
-EAPI int e_focus_event_mouse_up(E_Border* bd);
+EAPI void e_focus_event_mouse_in(E_Border* bd);
+EAPI void e_focus_event_mouse_out(E_Border* bd);
+EAPI void e_focus_event_mouse_down(E_Border* bd);
+EAPI void e_focus_event_mouse_up(E_Border* bd);
+EAPI void e_focus_event_focus_in(E_Border *bd);
+EAPI void e_focus_event_focus_out(E_Border *bd);
+EAPI void e_focus_setup(E_Border *bd);
+EAPI void e_focus_setdown(E_Border *bd);
     
 #endif
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_ipc.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- e_ipc.c     20 May 2005 07:32:42 -0000      1.28
+++ e_ipc.c     20 May 2005 09:27:06 -0000      1.29
@@ -27,8 +27,6 @@
 ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_key_binding_enc);
 ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_key_binding_dec);
 ECORE_IPC_ENC_EVAS_LIST_PROTO(_e_ipc_path_list_enc);
-ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_focus_policy_enc);
-ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_focus_policy_dec);
 
 /* local subsystem globals */
 static Ecore_Ipc_Server *_e_ipc_server  = NULL;
@@ -738,35 +736,17 @@
                               E_IPC_OP_DESKS_GET_REPLY);
        break;
       case E_IPC_OP_FOCUS_POLICY_SET:
+       if (e_ipc_codec_int_dec(e->data, e->size,
+                               &(e_config->focus_policy)))
          {
-            E_Config_Focus_Policy policy;
-            
-            _e_ipc_focus_policy_dec(e->data, e->size, &policy);
-            e_config->focus_policy = policy.focus_policy;
-            e_config->raise_timer = policy.raise_timer;
-            
+            /* FIXME: if going to/from click to focus grab/ungrab */
+            e_config_save_queue();
          }
        break;
       case E_IPC_OP_FOCUS_POLICY_GET:
-         {
-            int bytes;
-            E_Config_Focus_Policy policy;
-            char *data;
-            
-            policy.focus_policy = e_config->focus_policy;
-            policy.raise_timer = e_config->raise_timer;
-            
-            data = _e_ipc_focus_policy_enc(&policy, &bytes);
-            
-            ecore_ipc_client_send(e->client,
-                                  E_IPC_DOMAIN_REPLY,
-                                  E_IPC_OP_FOCUS_POLICY_GET_REPLY,
-                                  0, 0, 0,
-                                  data, bytes);
-            
-            free(data);
-            
-         }
+       _e_ipc_reply_int_send(e->client,
+                             e_config->focus_policy,
+                             E_IPC_OP_FOCUS_POLICY_GET_REPLY);
        break;
       case E_IPC_OP_MODULE_DIRS_LIST:
          {
@@ -1519,22 +1499,3 @@
    ECORE_IPC_PUTS(dir, l1);
    ECORE_IPC_ENC_EVAS_LIST_FOOT();
 }
-
-ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_focus_policy_enc)
-{
-   ECORE_IPC_ENC_STRUCT_HEAD(E_Config_Focus_Policy,
-                            1 + 4);
-   ECORE_IPC_PUT8(focus_policy);
-   ECORE_IPC_PUT32(raise_timer);
-   ECORE_IPC_ENC_STRUCT_FOOT();
-}
-
-ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_focus_policy_dec)
-{
-   ECORE_IPC_DEC_STRUCT_HEAD_MIN(E_Config_Focus_Policy,
-                                1 + 4);
-   ECORE_IPC_CHEKS();
-   ECORE_IPC_GET8(focus_policy);
-   ECORE_IPC_GET32(raise_timer);
-   ECORE_IPC_DEC_STRUCT_FOOT();
-}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_remote_main.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- e_remote_main.c     20 May 2005 07:32:42 -0000      1.28
+++ e_remote_main.c     20 May 2005 09:27:06 -0000      1.29
@@ -43,8 +43,6 @@
 ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_key_binding_enc);
 ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_key_binding_dec);
 ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_path_list_dec);
-ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_focus_policy_enc);
-ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_focus_policy_dec);
 
 /* local subsystem globals */
 static Ecore_Ipc_Server *_e_ipc_server  = NULL;
@@ -242,79 +240,27 @@
    free(data);
 }
 
-static void _e_opt_focus_policy_parse(E_Config_Focus_Policy* policy, char 
**params)
-{
-   /* M1[|M2...] */
-     {
-       char *p, *pp;
-       
-       policy->focus_policy = 0;
-       pp = params[0];
-       for (;;)
-         {
-            p = strchr(pp, '|');
-            if (p)
-              {
-                 if (!strncmp(pp, "FOLLOW|", 7))
-                   policy->focus_policy |= E_FOCUS_FOLLOW_MOUSE;
-                 else if (!strncmp(pp, "CLICK|", 6))
-                   policy->focus_policy &= 
-                      ~(E_FOCUS_FOLLOW_MOUSE | E_FOCUS_AUTORAISE);
-                 else if (!strncmp(pp, "AUTORAISE|", 10)) 
-                   policy->focus_policy |= E_FOCUS_AUTORAISE;
-                 else if (strlen(pp) > 0)
-                   {
-                      printf("OPT1 option. Must be or mask of:\n"
-                             "  FOLLOW CLICK AUTORAISE\n");
-                      exit(-1);
-                   }
-                 pp = p + 1;
-              }
-            else
-              {
-                 if (!strcmp(pp, "FOLLOW"))
-                   policy->focus_policy |= E_FOCUS_FOLLOW_MOUSE;
-                 else if (!strcmp(pp, "CLICK"))
-                   policy->focus_policy &= 
-                      ~(E_FOCUS_FOLLOW_MOUSE | E_FOCUS_AUTORAISE);
-                 else if (!strcmp(pp, "AUTORAISE")) 
-                   policy->focus_policy |= E_FOCUS_AUTORAISE;
-                 else if (strlen(pp) > 0)
-                   {
-                      printf("OPT1 option. Must be or mask of:\n"
-                             "  FOLLOW CLICK AUTORAISE\n");
-                      exit(-1);
-                   }
-                 break;
-              }
-         }
-     }
-
-   if(params[1][0] != 0)
-     policy->raise_timer = atoi(params[1]);
-   else if(policy->focus_policy & E_FOCUS_AUTORAISE)
-     {
-       printf("OPT2 option is should be seted, if you use AUTORAISE.\n");
-     }
-
-}
-
-
 static void
-_e_opt_focus_policy_set(char** params)
+_e_opt_focus_policy_set(char **params)
 {
-   E_Config_Focus_Policy policy;
    int bytes;
    char *data;
-
-   _e_opt_focus_policy_parse(&policy, params);
-   data = _e_ipc_focus_policy_enc(&policy, &bytes);
+   int value;
+   
+   value = 0;
+   if (!strcmp(params[0], "MOUSE")) value = E_FOCUS_MOUSE;
+   else if (!strcmp(params[0], "CLICK")) value = E_FOCUS_CLICK;
+   else
+     {
+       printf("focus must be MOUSE or CLICK\n");
+       exit(-1);
+     }
+   data = e_ipc_codec_int_enc(value, &bytes);
    ecore_ipc_server_send(_e_ipc_server,
                         E_IPC_DOMAIN_REQUEST,
                         E_IPC_OP_FOCUS_POLICY_SET,
                         0, 0, 0,
                         data, bytes);
-
    free(data);
 }
 
@@ -424,7 +370,7 @@
    OREQ("-desks-get", "Get the number of virtual desktops", 
E_IPC_OP_DESKS_GET, 1),
    O2INT("-desks-set", "Set the number of virtual desktops (X x Y. OPT1 = X, 
OPT2 = Y)", E_IPC_OP_DESKS_SET, 0),
    OREQ("-desks-get", "Get the number of virtual desktops", 
E_IPC_OP_DESKS_GET, 1),
-   OFNC("-focus-policy-set", "Set focus policy. OPT1 = Policy. OPT2 = Raise 
Time.", 2, _e_opt_focus_policy_set, 0),
+   OFNC("-focus-policy-set", "Set focus policy. OPT1 = CLICK or MOUSE", 1, 
_e_opt_focus_policy_set, 0),
    OREQ("-focus-policy-get", "Get focus policy.", E_IPC_OP_FOCUS_POLICY_GET, 1)
 };
 
@@ -1110,12 +1056,18 @@
          }
        break;
       case E_IPC_OP_FOCUS_POLICY_GET_REPLY:
-       if(e->data)
+       if (e->data)
          {
-            E_Config_Focus_Policy policy;
-
-            if(_e_ipc_focus_policy_dec(e->data, e->size, &policy))
-              printf("REPLY: %i %i\n", policy.focus_policy, 
policy.raise_timer);
+            int value;
+            
+            if (e_ipc_codec_int_dec(e->data, e->size,
+                               &(value)))
+              {
+                 if (value == E_FOCUS_MOUSE)
+                   printf("REPLY: MOUSE\n");
+                 else if (value == E_FOCUS_CLICK)
+                   printf("REPLY: CLICK\n");
+              }
          }
        break;
        
@@ -1369,28 +1321,10 @@
    ECORE_IPC_GET8(any_mod);
    ECORE_IPC_DEC_STRUCT_FOOT();
 }
+
 ECORE_IPC_DEC_EVAS_LIST_PROTO(_e_ipc_path_list_dec)
 {
    ECORE_IPC_DEC_EVAS_LIST_HEAD(E_Path_Dir);
    ECORE_IPC_GETS(dir);
    ECORE_IPC_DEC_EVAS_LIST_FOOT();
 }
-
-ECORE_IPC_ENC_STRUCT_PROTO(_e_ipc_focus_policy_enc)
-{
-   ECORE_IPC_ENC_STRUCT_HEAD(E_Config_Focus_Policy,
-        1 + 4);
-   ECORE_IPC_PUT8(focus_policy);
-   ECORE_IPC_PUT32(raise_timer);
-   ECORE_IPC_ENC_STRUCT_FOOT();
-}
-
-ECORE_IPC_DEC_STRUCT_PROTO(_e_ipc_focus_policy_dec)
-{
-   ECORE_IPC_DEC_STRUCT_HEAD_MIN(E_Config_Focus_Policy,
-        1 + 4);
-   ECORE_IPC_CHEKS();
-   ECORE_IPC_GET8(focus_policy);
-   ECORE_IPC_GET32(raise_timer);
-   ECORE_IPC_DEC_STRUCT_FOOT();
-}




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to