Add config options to lock dragables.
authorChristopher Michael <cpmichael1@comcast.net>
Wed, 16 Dec 2009 20:12:49 +0000 (20:12 +0000)
committerChristopher Michael <cpmichael1@comcast.net>
Wed, 16 Dec 2009 20:12:49 +0000 (20:12 +0000)
Cleanup some code.

SVN revision: 44515

src/modules/illume2/e_mod_config.c
src/modules/illume2/e_mod_config.h
src/modules/illume2/e_mod_layout_illume.c
src/modules/illume2/e_mod_policy_settings.c

index 0e023d3..afc74ca 100644 (file)
@@ -41,6 +41,7 @@ il_config_init(E_Module *m)
    E_CONFIG_VAL(D, T, policy.softkey.match.name, INT);
    E_CONFIG_VAL(D, T, policy.softkey.match.title, INT);
    E_CONFIG_VAL(D, T, policy.softkey.match.win_type, INT);
+   E_CONFIG_VAL(D, T, policy.softkey.locked, INT);
    E_CONFIG_VAL(D, T, policy.home.class, STR);
    E_CONFIG_VAL(D, T, policy.home.name, STR);
    E_CONFIG_VAL(D, T, policy.home.title, STR);
@@ -57,6 +58,7 @@ il_config_init(E_Module *m)
    E_CONFIG_VAL(D, T, policy.indicator.match.name, INT);
    E_CONFIG_VAL(D, T, policy.indicator.match.title, INT);
    E_CONFIG_VAL(D, T, policy.indicator.match.win_type, INT);
+   E_CONFIG_VAL(D, T, policy.indicator.locked, INT);
 
    il_cfg = e_config_domain_load("module.illume2", conf_edd);
    if ((il_cfg) && 
@@ -128,6 +130,11 @@ il_config_init(E_Module *m)
              il_cfg->policy.mode.dual = 0;
              il_cfg->policy.mode.side = 0;
           }
+        if ((il_cfg->version & 0xffff) < 3) 
+          {
+             il_cfg->policy.softkey.locked = 1;
+             il_cfg->policy.indicator.locked = 1;
+          }
         il_cfg->version = (IL_CONFIG_MAJ << 16) | IL_CONFIG_MIN;
      }
    il_cfg->mod_dir = eina_stringshare_add(m->dir);
index 1f3b648..b66dcf0 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef E_MOD_CONFIG_H
 # define E_MOD_CONFIG_H
 
-# define IL_CONFIG_MIN 2
+# define IL_CONFIG_MIN 3
 # define IL_CONFIG_MAJ 0
 
 typedef struct _Il_Config Il_Config;
@@ -26,7 +26,7 @@ struct _Il_Config
              const char *class;
              const char *name;
              const char *title;
-             int win_type;
+             int win_type, locked;
              struct 
                {
                   int class, name, title, win_type;
index befabf3..b97ea32 100644 (file)
@@ -46,6 +46,7 @@ void
 illume_layout_illume_init(void) 
 {
    illume_layout_mode_register(&laymode);
+
    handlers = 
      eina_list_append(handlers, 
                       ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, 
@@ -231,7 +232,9 @@ _drag_start(E_Border *bd)
    ecore_x_window_show(_drag_win);
    if (!e_grabinput_get(_drag_win, 1, _drag_win)) 
      {
+        printf("Grab Input Failed\n");
         ecore_x_window_free(_drag_win);
+        _drag_win = 0;
         return;
      }
    _drag_border = bd;
@@ -241,6 +244,11 @@ static void
 _drag_end(E_Border *bd) 
 {
    /* HANDLE A BORDER DRAG BEING ENDED */
+
+   e_grabinput_release(_drag_win, _drag_win);
+   ecore_x_window_free(_drag_win);
+   _drag_win = 0;
+
    ecore_x_e_illume_drag_set(bd->client.win, 0);
    _drag_border = NULL;
 }
@@ -538,9 +546,6 @@ _cb_mouse_up(void *data, int type, void *event)
 
    ev = event;
    if (ev->window != _drag_win) return 1;
-   e_grabinput_release(_drag_win, _drag_win);
-   ecore_x_window_free(_drag_win);
-   _drag_win = 0;
    ecore_x_e_illume_drag_end_send(_drag_border->client.win);
    return 1;
 }
index 04b0170..8e1e2bb 100644 (file)
@@ -1,5 +1,6 @@
 #include "e.h"
 #include "e_mod_config.h"
+#include "e_mod_layout.h"
 #include "e_mod_policy_settings.h"
 
 /* local function prototypes */
@@ -77,6 +78,19 @@ _il_config_policy_settings_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_
                                   _il_config_policy_settings_changed, NULL);
    e_widget_list_object_append(list, of, 1, 0, 0.0);
 
+   of = e_widget_framelist_add(evas, _("Drag"), 0);
+   ow = e_widget_check_add(evas, _("Lock Top Shelf Position"), 
+                           &(il_cfg->policy.indicator.locked));
+   evas_object_smart_callback_add(ow, "changed", 
+                                  _il_config_policy_settings_changed, NULL);
+   e_widget_framelist_object_append(of, ow);
+   ow = e_widget_check_add(evas, _("Lock Bottom Panel Position"), 
+                           &(il_cfg->policy.softkey.locked));
+   evas_object_smart_callback_add(ow, "changed", 
+                                  _il_config_policy_settings_changed, NULL);
+   e_widget_framelist_object_append(of, ow);
+   e_widget_list_object_append(list, of, 1, 0, 0.0);
+
    e_widget_disabled_set(o_top, !il_cfg->policy.mode.dual);
    e_widget_disabled_set(o_left, !il_cfg->policy.mode.dual);
 
@@ -86,6 +100,15 @@ _il_config_policy_settings_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_
 static void 
 _il_config_policy_settings_changed(void *data, Evas_Object *obj, void *event) 
 {
+   E_Border *bd;
+
+   bd = illume_border_top_shelf_get();
+   if (bd) ecore_x_e_illume_drag_locked_set(bd->client.win, 
+                                            il_cfg->policy.indicator.locked);
+   bd = illume_border_bottom_panel_get();
+   if (bd) ecore_x_e_illume_drag_locked_set(bd->client.win, 
+                                            il_cfg->policy.softkey.locked);
+
    e_widget_disabled_set(o_top, !il_cfg->policy.mode.dual);
    e_widget_disabled_set(o_left, !il_cfg->policy.mode.dual);
    if (_ps_change_timer) ecore_timer_del(_ps_change_timer);