forked from enlightenment/enlightenment
Add separate file for Window Selection.
Add code to handle selecting which window will be home, vkbd, etc. SVN revision: 44068
This commit is contained in:
parent
f6b0251f3a
commit
5d6199390e
|
@ -32,7 +32,9 @@ module_la_SOURCES = e_mod_main.h \
|
||||||
e_mod_animation.h \
|
e_mod_animation.h \
|
||||||
e_mod_animation.c \
|
e_mod_animation.c \
|
||||||
e_mod_windows.h \
|
e_mod_windows.h \
|
||||||
e_mod_windows.c
|
e_mod_windows.c \
|
||||||
|
e_mod_select_window.h \
|
||||||
|
e_mod_select_window.c
|
||||||
|
|
||||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||||
module_la_LDFLAGS = -module -avoid-version
|
module_la_LDFLAGS = -module -avoid-version
|
||||||
|
|
|
@ -0,0 +1,272 @@
|
||||||
|
#include "e.h"
|
||||||
|
#include "e_mod_main.h"
|
||||||
|
#include "e_mod_select_window.h"
|
||||||
|
#include "e_mod_config.h"
|
||||||
|
|
||||||
|
/* local function prototypes */
|
||||||
|
static void *_il_config_select_window_create_data(E_Config_Dialog *cfd);
|
||||||
|
static void _il_config_select_window_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||||
|
static Evas_Object *_il_config_select_window_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||||
|
static void _il_config_select_window_list_changed(void *data);
|
||||||
|
static int _il_config_select_window_change_timeout(void *data);
|
||||||
|
static int _il_config_select_window_match(E_Border *bd);
|
||||||
|
|
||||||
|
/* local variables */
|
||||||
|
Il_Select_Window_Type stype;
|
||||||
|
Ecore_Timer *_change_timer = NULL;
|
||||||
|
|
||||||
|
/* public functions */
|
||||||
|
E_Config_Dialog *
|
||||||
|
il_config_select_window(Il_Select_Window_Type type)
|
||||||
|
{
|
||||||
|
E_Config_Dialog *cfd;
|
||||||
|
E_Config_Dialog_View *v;
|
||||||
|
|
||||||
|
if (e_config_dialog_find("E", "_config_illume_select_window")) return NULL;
|
||||||
|
stype = type;
|
||||||
|
v = E_NEW(E_Config_Dialog_View, 1);
|
||||||
|
v->create_cfdata = _il_config_select_window_create_data;
|
||||||
|
v->free_cfdata = _il_config_select_window_free_data;
|
||||||
|
v->basic.create_widgets = _il_config_select_window_create;
|
||||||
|
v->basic_only = 1;
|
||||||
|
v->normal_win = 1;
|
||||||
|
v->scroll = 1;
|
||||||
|
cfd = e_config_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||||
|
_("Select Home Window"), "E",
|
||||||
|
"_config_illume_select_window",
|
||||||
|
"enlightenment/windows", 0, v, NULL);
|
||||||
|
e_dialog_resizable_set(cfd->dia, 1);
|
||||||
|
return cfd;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
_il_config_select_window_create_data(E_Config_Dialog *cfd)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_il_config_select_window_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_il_config_select_window_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
|
{
|
||||||
|
Evas_Object *list, *ow;
|
||||||
|
Eina_List *bds, *l;
|
||||||
|
int i = 0, sel = 0;
|
||||||
|
|
||||||
|
list = e_widget_list_add(evas, 0, 0);
|
||||||
|
ow = e_widget_ilist_add(evas, 24, 24, NULL);
|
||||||
|
e_widget_ilist_selector_set(ow, 1);
|
||||||
|
evas_event_freeze(evas);
|
||||||
|
edje_freeze();
|
||||||
|
e_widget_ilist_freeze(ow);
|
||||||
|
e_widget_ilist_clear(ow);
|
||||||
|
e_widget_ilist_go(ow);
|
||||||
|
|
||||||
|
bds = e_border_client_list();
|
||||||
|
for (i = 0, l = bds; l; l = l->next, i++)
|
||||||
|
{
|
||||||
|
E_Border *bd;
|
||||||
|
const char *name;
|
||||||
|
|
||||||
|
if (!(bd = l->data)) continue;
|
||||||
|
if (e_object_is_del(E_OBJECT(bd))) continue;
|
||||||
|
if (_il_config_select_window_match(bd)) sel = i;
|
||||||
|
name = e_border_name_get(bd);
|
||||||
|
e_widget_ilist_append(ow, NULL, name,
|
||||||
|
_il_config_select_window_list_changed,
|
||||||
|
bd, name);
|
||||||
|
}
|
||||||
|
e_widget_size_min_set(ow, 100, 200);
|
||||||
|
e_widget_ilist_go(ow);
|
||||||
|
e_widget_ilist_selected_set(ow, sel);
|
||||||
|
e_widget_ilist_thaw(ow);
|
||||||
|
edje_thaw();
|
||||||
|
evas_event_thaw(evas);
|
||||||
|
e_widget_list_object_append(list, ow, 1, 0, 0.0);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_il_config_select_window_list_changed(void *data)
|
||||||
|
{
|
||||||
|
E_Border *bd;
|
||||||
|
Ecore_X_Window_Type wtype;
|
||||||
|
char *title, *name, *class;
|
||||||
|
|
||||||
|
if (!(bd = data)) return;
|
||||||
|
title = ecore_x_icccm_title_get(bd->client.win);
|
||||||
|
ecore_x_icccm_name_class_get(bd->client.win, &name, &class);
|
||||||
|
ecore_x_netwm_window_type_get(bd->client.win, &wtype);
|
||||||
|
|
||||||
|
switch (stype)
|
||||||
|
{
|
||||||
|
case IL_SELECT_WINDOW_TYPE_HOME:
|
||||||
|
if (il_cfg->policy.home.title)
|
||||||
|
eina_stringshare_del(il_cfg->policy.home.title);
|
||||||
|
if (title) il_cfg->policy.home.title = eina_stringshare_add(title);
|
||||||
|
if (il_cfg->policy.home.class)
|
||||||
|
eina_stringshare_del(il_cfg->policy.home.class);
|
||||||
|
if (class) il_cfg->policy.home.class = eina_stringshare_add(class);
|
||||||
|
if (il_cfg->policy.home.name)
|
||||||
|
eina_stringshare_del(il_cfg->policy.home.name);
|
||||||
|
if (name) il_cfg->policy.home.name = eina_stringshare_add(name);
|
||||||
|
break;
|
||||||
|
case IL_SELECT_WINDOW_TYPE_VKBD:
|
||||||
|
if (il_cfg->policy.vkbd.title)
|
||||||
|
eina_stringshare_del(il_cfg->policy.vkbd.title);
|
||||||
|
if (title) il_cfg->policy.vkbd.title = eina_stringshare_add(title);
|
||||||
|
if (il_cfg->policy.vkbd.class)
|
||||||
|
eina_stringshare_del(il_cfg->policy.vkbd.class);
|
||||||
|
if (class) il_cfg->policy.vkbd.class = eina_stringshare_add(class);
|
||||||
|
if (il_cfg->policy.vkbd.name)
|
||||||
|
eina_stringshare_del(il_cfg->policy.vkbd.name);
|
||||||
|
if (name) il_cfg->policy.vkbd.name = eina_stringshare_add(name);
|
||||||
|
break;
|
||||||
|
case IL_SELECT_WINDOW_TYPE_SOFTKEY:
|
||||||
|
if (il_cfg->policy.softkey.title)
|
||||||
|
eina_stringshare_del(il_cfg->policy.softkey.title);
|
||||||
|
if (title) il_cfg->policy.softkey.title = eina_stringshare_add(title);
|
||||||
|
if (il_cfg->policy.softkey.class)
|
||||||
|
eina_stringshare_del(il_cfg->policy.softkey.class);
|
||||||
|
if (class) il_cfg->policy.softkey.class = eina_stringshare_add(class);
|
||||||
|
if (il_cfg->policy.softkey.name)
|
||||||
|
eina_stringshare_del(il_cfg->policy.softkey.name);
|
||||||
|
if (name) il_cfg->policy.softkey.name = eina_stringshare_add(name);
|
||||||
|
break;
|
||||||
|
case IL_SELECT_WINDOW_TYPE_INDICATOR:
|
||||||
|
if (il_cfg->policy.indicator.title)
|
||||||
|
eina_stringshare_del(il_cfg->policy.indicator.title);
|
||||||
|
if (title) il_cfg->policy.indicator.title = eina_stringshare_add(title);
|
||||||
|
if (il_cfg->policy.indicator.class)
|
||||||
|
eina_stringshare_del(il_cfg->policy.indicator.class);
|
||||||
|
if (class) il_cfg->policy.indicator.class = eina_stringshare_add(class);
|
||||||
|
if (il_cfg->policy.indicator.name)
|
||||||
|
eina_stringshare_del(il_cfg->policy.indicator.name);
|
||||||
|
if (name) il_cfg->policy.indicator.name = eina_stringshare_add(name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (title) free(title);
|
||||||
|
if (name) free(name);
|
||||||
|
if (class) free(class);
|
||||||
|
|
||||||
|
if (_change_timer) ecore_timer_del(_change_timer);
|
||||||
|
_change_timer =
|
||||||
|
ecore_timer_add(0.5, _il_config_select_window_change_timeout, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_il_config_select_window_change_timeout(void *data)
|
||||||
|
{
|
||||||
|
e_config_save_queue();
|
||||||
|
_change_timer = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_il_config_select_window_match(E_Border *bd)
|
||||||
|
{
|
||||||
|
Ecore_X_Window_Type wtype;
|
||||||
|
char *title, *name, *class;
|
||||||
|
int match = 0;
|
||||||
|
|
||||||
|
if (!bd) return 0;
|
||||||
|
title = ecore_x_icccm_title_get(bd->client.win);
|
||||||
|
ecore_x_icccm_name_class_get(bd->client.win, &name, &class);
|
||||||
|
ecore_x_netwm_window_type_get(bd->client.win, &wtype);
|
||||||
|
|
||||||
|
switch (stype)
|
||||||
|
{
|
||||||
|
case IL_SELECT_WINDOW_TYPE_HOME:
|
||||||
|
if (il_cfg->policy.home.match.title)
|
||||||
|
{
|
||||||
|
if ((title) && (!strcmp(title, il_cfg->policy.home.title)))
|
||||||
|
match = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (il_cfg->policy.home.match.name)
|
||||||
|
{
|
||||||
|
if ((name) && (!strcmp(name, il_cfg->policy.home.name)))
|
||||||
|
match = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (il_cfg->policy.home.match.class)
|
||||||
|
{
|
||||||
|
if ((class) && (!strcmp(class, il_cfg->policy.home.class)))
|
||||||
|
match = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IL_SELECT_WINDOW_TYPE_VKBD:
|
||||||
|
if (il_cfg->policy.vkbd.match.title)
|
||||||
|
{
|
||||||
|
if ((title) && (!strcmp(title, il_cfg->policy.vkbd.title)))
|
||||||
|
match = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (il_cfg->policy.vkbd.match.name)
|
||||||
|
{
|
||||||
|
if ((name) && (!strcmp(name, il_cfg->policy.vkbd.name)))
|
||||||
|
match = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (il_cfg->policy.vkbd.match.class)
|
||||||
|
{
|
||||||
|
if ((class) && (!strcmp(class, il_cfg->policy.vkbd.class)))
|
||||||
|
match = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IL_SELECT_WINDOW_TYPE_SOFTKEY:
|
||||||
|
if (il_cfg->policy.softkey.match.title)
|
||||||
|
{
|
||||||
|
if ((title) && (!strcmp(title, il_cfg->policy.softkey.title)))
|
||||||
|
match = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (il_cfg->policy.softkey.match.name)
|
||||||
|
{
|
||||||
|
if ((name) && (!strcmp(name, il_cfg->policy.softkey.name)))
|
||||||
|
match = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (il_cfg->policy.softkey.match.class)
|
||||||
|
{
|
||||||
|
if ((class) && (!strcmp(class, il_cfg->policy.softkey.class)))
|
||||||
|
match = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case IL_SELECT_WINDOW_TYPE_INDICATOR:
|
||||||
|
if (il_cfg->policy.indicator.match.title)
|
||||||
|
{
|
||||||
|
if ((title) && (!strcmp(title, il_cfg->policy.indicator.title)))
|
||||||
|
match = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (il_cfg->policy.indicator.match.name)
|
||||||
|
{
|
||||||
|
if ((name) && (!strcmp(name, il_cfg->policy.indicator.name)))
|
||||||
|
match = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (il_cfg->policy.indicator.match.class)
|
||||||
|
{
|
||||||
|
if ((class) && (!strcmp(class, il_cfg->policy.indicator.class)))
|
||||||
|
match = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (title) free(title);
|
||||||
|
if (name) free(name);
|
||||||
|
if (class) free(class);
|
||||||
|
|
||||||
|
return match;
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
#ifndef E_MOD_SELECT_WINDOW_H
|
||||||
|
#define E_MOD_SELECT_WINDOW_H
|
||||||
|
|
||||||
|
typedef enum _Il_Select_Window_Type Il_Select_Window_Type;
|
||||||
|
enum _Il_Select_Window_Type
|
||||||
|
{
|
||||||
|
IL_SELECT_WINDOW_TYPE_HOME,
|
||||||
|
IL_SELECT_WINDOW_TYPE_VKBD,
|
||||||
|
IL_SELECT_WINDOW_TYPE_SOFTKEY,
|
||||||
|
IL_SELECT_WINDOW_TYPE_INDICATOR
|
||||||
|
};
|
||||||
|
|
||||||
|
E_Config_Dialog *il_config_select_window(Il_Select_Window_Type type);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,6 +1,7 @@
|
||||||
#include "e.h"
|
#include "e.h"
|
||||||
#include "e_mod_windows.h"
|
#include "e_mod_windows.h"
|
||||||
#include "e_mod_config.h"
|
#include "e_mod_config.h"
|
||||||
|
#include "e_mod_select_window.h"
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
static void *_il_config_windows_create(E_Config_Dialog *cfd);
|
static void *_il_config_windows_create(E_Config_Dialog *cfd);
|
||||||
|
@ -9,30 +10,16 @@ static Evas_Object *_il_config_windows_ui(E_Config_Dialog *cfd, Evas *evas, E_Co
|
||||||
static void _il_config_windows_check_changed(void *data, Evas_Object *obj, void *event);
|
static void _il_config_windows_check_changed(void *data, Evas_Object *obj, void *event);
|
||||||
static void _il_config_windows_change(void *data, Evas_Object *obj, void *event);
|
static void _il_config_windows_change(void *data, Evas_Object *obj, void *event);
|
||||||
static int _il_config_windows_change_timeout(void *data);
|
static int _il_config_windows_change_timeout(void *data);
|
||||||
static void _il_config_windows_select_window_create(void);
|
|
||||||
static int _il_config_windows_cb_key_down(void *data, int type, void *event);
|
|
||||||
static int _il_config_windows_cb_mouse_up(void *data, int type, void *event);
|
|
||||||
static void _il_config_windows_select_home(void *data, void *data2);
|
static void _il_config_windows_select_home(void *data, void *data2);
|
||||||
static void _il_config_windows_select_vkbd(void *data, void *data2);
|
static void _il_config_windows_select_vkbd(void *data, void *data2);
|
||||||
static void _il_config_windows_select_softkey(void *data, void *data2);
|
static void _il_config_windows_select_softkey(void *data, void *data2);
|
||||||
static void _il_config_windows_select_indicator(void *data, void *data2);
|
static void _il_config_windows_select_indicator(void *data, void *data2);
|
||||||
static void _il_config_windows_event_free(void *data, void *event);
|
|
||||||
static int _il_config_windows_home_selected(void *data, int type, void *event);
|
|
||||||
static int _il_config_windows_vkbd_selected(void *data, int type, void *event);
|
|
||||||
static int _il_config_windows_softkey_selected(void *data, int type, void *event);
|
|
||||||
static int _il_config_windows_indicator_selected(void *data, int type, void *event);
|
|
||||||
|
|
||||||
/* local variables */
|
/* local variables */
|
||||||
EAPI int IL_EVENT_WINDOW_SELECTED = 0;
|
|
||||||
Ecore_Timer *_windows_change_timer = NULL;
|
Ecore_Timer *_windows_change_timer = NULL;
|
||||||
static Ecore_X_Window input_window = 0;
|
|
||||||
static Ecore_X_Window selected_window = 0;
|
|
||||||
static Ecore_Event_Handler *mouse_hdl = 0;
|
|
||||||
static Ecore_Event_Handler *key_hdl = 0;
|
|
||||||
static Ecore_Event_Handler *sel_hdl = 0;
|
|
||||||
|
|
||||||
/* public functions */
|
/* public functions */
|
||||||
EAPI void
|
void
|
||||||
il_config_windows_show(E_Container *con, const char *params)
|
il_config_windows_show(E_Container *con, const char *params)
|
||||||
{
|
{
|
||||||
E_Config_Dialog *cfd;
|
E_Config_Dialog *cfd;
|
||||||
|
@ -40,8 +27,6 @@ il_config_windows_show(E_Container *con, const char *params)
|
||||||
|
|
||||||
if (e_config_dialog_find("E", "_config_illume_windows_settings")) return;
|
if (e_config_dialog_find("E", "_config_illume_windows_settings")) return;
|
||||||
|
|
||||||
IL_EVENT_WINDOW_SELECTED = ecore_event_type_new();
|
|
||||||
|
|
||||||
v = E_NEW(E_Config_Dialog_View, 1);
|
v = E_NEW(E_Config_Dialog_View, 1);
|
||||||
v->create_cfdata = _il_config_windows_create;
|
v->create_cfdata = _il_config_windows_create;
|
||||||
v->free_cfdata = _il_config_windows_free;
|
v->free_cfdata = _il_config_windows_free;
|
||||||
|
@ -65,17 +50,7 @@ _il_config_windows_create(E_Config_Dialog *cfd)
|
||||||
static void
|
static void
|
||||||
_il_config_windows_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
_il_config_windows_free(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
IL_EVENT_WINDOW_SELECTED = 0;
|
|
||||||
if (_windows_change_timer) ecore_timer_del(_windows_change_timer);
|
if (_windows_change_timer) ecore_timer_del(_windows_change_timer);
|
||||||
|
|
||||||
ecore_x_keyboard_ungrab();
|
|
||||||
if (input_window) ecore_x_window_free(input_window);
|
|
||||||
input_window = 0;
|
|
||||||
selected_window = 0;
|
|
||||||
|
|
||||||
if (key_hdl) ecore_event_handler_del(key_hdl);
|
|
||||||
if (mouse_hdl) ecore_event_handler_del(mouse_hdl);
|
|
||||||
if (sel_hdl) ecore_event_handler_del(sel_hdl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
|
@ -87,7 +62,7 @@ _il_config_windows_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
|
|
||||||
of = e_widget_framelist_add(evas, _("Home"), 0);
|
of = e_widget_framelist_add(evas, _("Home"), 0);
|
||||||
ow = e_widget_button_add(evas, _("Select Window"), NULL,
|
ow = e_widget_button_add(evas, _("Select Window"), NULL,
|
||||||
_il_config_windows_select_home, NULL, NULL);
|
_il_config_windows_select_home, cfd, NULL);
|
||||||
e_widget_framelist_object_append(of, ow);
|
e_widget_framelist_object_append(of, ow);
|
||||||
ow = e_widget_check_add(evas, _("Match Window Class"),
|
ow = e_widget_check_add(evas, _("Match Window Class"),
|
||||||
&il_cfg->policy.home.match.class);
|
&il_cfg->policy.home.match.class);
|
||||||
|
@ -113,7 +88,7 @@ _il_config_windows_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
|
|
||||||
of = e_widget_framelist_add(evas, _("Indicator"), 0);
|
of = e_widget_framelist_add(evas, _("Indicator"), 0);
|
||||||
ow = e_widget_button_add(evas, _("Select Window"), NULL,
|
ow = e_widget_button_add(evas, _("Select Window"), NULL,
|
||||||
_il_config_windows_select_indicator, NULL, NULL);
|
_il_config_windows_select_indicator, cfd, NULL);
|
||||||
e_widget_framelist_object_append(of, ow);
|
e_widget_framelist_object_append(of, ow);
|
||||||
ow = e_widget_check_add(evas, _("Match Window Class"),
|
ow = e_widget_check_add(evas, _("Match Window Class"),
|
||||||
&il_cfg->policy.indicator.match.class);
|
&il_cfg->policy.indicator.match.class);
|
||||||
|
@ -139,7 +114,7 @@ _il_config_windows_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
|
|
||||||
of = e_widget_framelist_add(evas, _("Keyboard"), 0);
|
of = e_widget_framelist_add(evas, _("Keyboard"), 0);
|
||||||
ow = e_widget_button_add(evas, _("Select Window"), NULL,
|
ow = e_widget_button_add(evas, _("Select Window"), NULL,
|
||||||
_il_config_windows_select_vkbd, NULL, NULL);
|
_il_config_windows_select_vkbd, cfd, NULL);
|
||||||
e_widget_framelist_object_append(of, ow);
|
e_widget_framelist_object_append(of, ow);
|
||||||
ow = e_widget_check_add(evas, _("Match Window Class"),
|
ow = e_widget_check_add(evas, _("Match Window Class"),
|
||||||
&il_cfg->policy.vkbd.match.class);
|
&il_cfg->policy.vkbd.match.class);
|
||||||
|
@ -165,7 +140,7 @@ _il_config_windows_ui(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
|
|
||||||
of = e_widget_framelist_add(evas, _("Softkey"), 0);
|
of = e_widget_framelist_add(evas, _("Softkey"), 0);
|
||||||
ow = e_widget_button_add(evas, _("Select Window"), NULL,
|
ow = e_widget_button_add(evas, _("Select Window"), NULL,
|
||||||
_il_config_windows_select_softkey, NULL, NULL);
|
_il_config_windows_select_softkey, cfd, NULL);
|
||||||
e_widget_framelist_object_append(of, ow);
|
e_widget_framelist_object_append(of, ow);
|
||||||
ow = e_widget_check_add(evas, _("Match Window Class"),
|
ow = e_widget_check_add(evas, _("Match Window Class"),
|
||||||
&il_cfg->policy.softkey.match.class);
|
&il_cfg->policy.softkey.match.class);
|
||||||
|
@ -214,231 +189,54 @@ _il_config_windows_change_timeout(void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_il_config_windows_select_window_create(void)
|
|
||||||
{
|
|
||||||
Ecore_X_Window root;
|
|
||||||
Ecore_X_Cursor cursor = 0;
|
|
||||||
int x, y, w, h;
|
|
||||||
|
|
||||||
selected_window = 0;
|
|
||||||
root = ecore_x_window_root_first_get();
|
|
||||||
ecore_x_window_geometry_get(root, &x, &y, &w, &h);
|
|
||||||
if (input_window) ecore_x_window_free(input_window);
|
|
||||||
input_window = ecore_x_window_input_new(root, x, y, w, h);
|
|
||||||
ecore_x_window_show(input_window);
|
|
||||||
ecore_x_keyboard_grab(input_window);
|
|
||||||
if ((cursor = ecore_x_cursor_shape_get(ECORE_X_CURSOR_CROSS)))
|
|
||||||
ecore_x_window_cursor_set(input_window, cursor);
|
|
||||||
key_hdl = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
|
|
||||||
_il_config_windows_cb_key_down, NULL);
|
|
||||||
mouse_hdl = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
|
|
||||||
_il_config_windows_cb_mouse_up, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_il_config_windows_cb_key_down(void *data, int type, void *event)
|
|
||||||
{
|
|
||||||
Ecore_Event_Key *ev;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
if (ev->window != input_window) return 1;
|
|
||||||
if (!strcmp(ev->key, "Escape"))
|
|
||||||
{
|
|
||||||
ecore_event_handler_del(key_hdl);
|
|
||||||
if (mouse_hdl) ecore_event_handler_del(mouse_hdl);
|
|
||||||
ecore_x_keyboard_ungrab();
|
|
||||||
ecore_x_window_free(input_window);
|
|
||||||
input_window = 0;
|
|
||||||
selected_window = 0;
|
|
||||||
if (sel_hdl) ecore_event_handler_del(sel_hdl);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_il_config_windows_cb_mouse_up(void *data, int type, void *event)
|
|
||||||
{
|
|
||||||
Ecore_Event_Mouse_Button *ev;
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
ev = event;
|
|
||||||
if (ev->buttons != 1) return 1;
|
|
||||||
if (ev->window != input_window) return 1;
|
|
||||||
ecore_x_pointer_last_xy_get(&x, &y);
|
|
||||||
selected_window = ecore_x_window_at_xy_get(x, y);
|
|
||||||
if (key_hdl) ecore_event_handler_del(key_hdl);
|
|
||||||
if (mouse_hdl) ecore_event_handler_del(mouse_hdl);
|
|
||||||
ecore_x_keyboard_ungrab();
|
|
||||||
ecore_x_window_free(input_window);
|
|
||||||
input_window = 0;
|
|
||||||
if (selected_window)
|
|
||||||
ecore_event_add(IL_EVENT_WINDOW_SELECTED, NULL,
|
|
||||||
_il_config_windows_event_free, NULL);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_il_config_windows_select_home(void *data, void *data2)
|
_il_config_windows_select_home(void *data, void *data2)
|
||||||
{
|
{
|
||||||
sel_hdl =
|
E_Config_Dialog *pcfd, *cfd;
|
||||||
ecore_event_handler_add(IL_EVENT_WINDOW_SELECTED,
|
|
||||||
_il_config_windows_home_selected, NULL);
|
if (!(pcfd = data)) return;
|
||||||
_il_config_windows_select_window_create();
|
if (e_config_dialog_find("E", "_config_illume_select_window")) return;
|
||||||
|
cfd = il_config_select_window(IL_SELECT_WINDOW_TYPE_HOME);
|
||||||
|
if (!cfd) return;
|
||||||
|
ecore_x_icccm_transient_for_set(cfd->dia->win->evas_win,
|
||||||
|
pcfd->dia->win->evas_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_il_config_windows_select_vkbd(void *data, void *data2)
|
_il_config_windows_select_vkbd(void *data, void *data2)
|
||||||
{
|
{
|
||||||
sel_hdl =
|
E_Config_Dialog *pcfd, *cfd;
|
||||||
ecore_event_handler_add(IL_EVENT_WINDOW_SELECTED,
|
|
||||||
_il_config_windows_vkbd_selected, NULL);
|
if (!(pcfd = data)) return;
|
||||||
_il_config_windows_select_window_create();
|
if (e_config_dialog_find("E", "_config_illume_select_window")) return;
|
||||||
|
cfd = il_config_select_window(IL_SELECT_WINDOW_TYPE_VKBD);
|
||||||
|
if (!cfd) return;
|
||||||
|
ecore_x_icccm_transient_for_set(cfd->dia->win->evas_win,
|
||||||
|
pcfd->dia->win->evas_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_il_config_windows_select_softkey(void *data, void *data2)
|
_il_config_windows_select_softkey(void *data, void *data2)
|
||||||
{
|
{
|
||||||
sel_hdl =
|
E_Config_Dialog *pcfd, *cfd;
|
||||||
ecore_event_handler_add(IL_EVENT_WINDOW_SELECTED,
|
|
||||||
_il_config_windows_softkey_selected, NULL);
|
if (!(pcfd = data)) return;
|
||||||
_il_config_windows_select_window_create();
|
if (e_config_dialog_find("E", "_config_illume_select_window")) return;
|
||||||
|
cfd = il_config_select_window(IL_SELECT_WINDOW_TYPE_SOFTKEY);
|
||||||
|
if (!cfd) return;
|
||||||
|
ecore_x_icccm_transient_for_set(cfd->dia->win->evas_win,
|
||||||
|
pcfd->dia->win->evas_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_il_config_windows_select_indicator(void *data, void *data2)
|
_il_config_windows_select_indicator(void *data, void *data2)
|
||||||
{
|
{
|
||||||
sel_hdl =
|
E_Config_Dialog *pcfd, *cfd;
|
||||||
ecore_event_handler_add(IL_EVENT_WINDOW_SELECTED,
|
|
||||||
_il_config_windows_indicator_selected, NULL);
|
if (!(pcfd = data)) return;
|
||||||
_il_config_windows_select_window_create();
|
if (e_config_dialog_find("E", "_config_illume_select_window")) return;
|
||||||
}
|
cfd = il_config_select_window(IL_SELECT_WINDOW_TYPE_INDICATOR);
|
||||||
|
if (!cfd) return;
|
||||||
static void
|
ecore_x_icccm_transient_for_set(cfd->dia->win->evas_win,
|
||||||
_il_config_windows_event_free(void *data, void *event)
|
pcfd->dia->win->evas_win);
|
||||||
{
|
|
||||||
if (sel_hdl) ecore_event_handler_del(sel_hdl);
|
|
||||||
sel_hdl = NULL;
|
|
||||||
selected_window = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_il_config_windows_home_selected(void *data, int type, void *event)
|
|
||||||
{
|
|
||||||
char *title, *name, *class;
|
|
||||||
Ecore_X_Window_Type wtype;
|
|
||||||
|
|
||||||
if (!selected_window) return 1;
|
|
||||||
title = ecore_x_icccm_title_get(selected_window);
|
|
||||||
ecore_x_icccm_name_class_get(selected_window, &name, &class);
|
|
||||||
ecore_x_netwm_window_type_get(selected_window, &wtype);
|
|
||||||
|
|
||||||
if (il_cfg->policy.home.title)
|
|
||||||
eina_stringshare_del(il_cfg->policy.home.title);
|
|
||||||
if (il_cfg->policy.home.class)
|
|
||||||
eina_stringshare_del(il_cfg->policy.home.class);
|
|
||||||
if (il_cfg->policy.home.name)
|
|
||||||
eina_stringshare_del(il_cfg->policy.home.name);
|
|
||||||
|
|
||||||
il_cfg->policy.home.title = eina_stringshare_add(title);
|
|
||||||
il_cfg->policy.home.class = eina_stringshare_add(class);
|
|
||||||
il_cfg->policy.home.name = eina_stringshare_add(name);
|
|
||||||
il_cfg->policy.home.win_type = wtype;
|
|
||||||
|
|
||||||
if (title) free(title);
|
|
||||||
if (name) free(name);
|
|
||||||
if (class) free(class);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_il_config_windows_vkbd_selected(void *data, int type, void *event)
|
|
||||||
{
|
|
||||||
char *title, *name, *class;
|
|
||||||
Ecore_X_Window_Type wtype;
|
|
||||||
|
|
||||||
if (!selected_window) return 1;
|
|
||||||
title = ecore_x_icccm_title_get(selected_window);
|
|
||||||
ecore_x_icccm_name_class_get(selected_window, &name, &class);
|
|
||||||
ecore_x_netwm_window_type_get(selected_window, &wtype);
|
|
||||||
|
|
||||||
if (il_cfg->policy.vkbd.title)
|
|
||||||
eina_stringshare_del(il_cfg->policy.vkbd.title);
|
|
||||||
if (il_cfg->policy.vkbd.class)
|
|
||||||
eina_stringshare_del(il_cfg->policy.vkbd.class);
|
|
||||||
if (il_cfg->policy.vkbd.name)
|
|
||||||
eina_stringshare_del(il_cfg->policy.vkbd.name);
|
|
||||||
|
|
||||||
il_cfg->policy.vkbd.title = eina_stringshare_add(title);
|
|
||||||
il_cfg->policy.vkbd.class = eina_stringshare_add(class);
|
|
||||||
il_cfg->policy.vkbd.name = eina_stringshare_add(name);
|
|
||||||
il_cfg->policy.vkbd.win_type = wtype;
|
|
||||||
|
|
||||||
if (title) free(title);
|
|
||||||
if (name) free(name);
|
|
||||||
if (class) free(class);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_il_config_windows_softkey_selected(void *data, int type, void *event)
|
|
||||||
{
|
|
||||||
char *title, *name, *class;
|
|
||||||
Ecore_X_Window_Type wtype;
|
|
||||||
|
|
||||||
if (!selected_window) return 1;
|
|
||||||
title = ecore_x_icccm_title_get(selected_window);
|
|
||||||
ecore_x_icccm_name_class_get(selected_window, &name, &class);
|
|
||||||
ecore_x_netwm_window_type_get(selected_window, &wtype);
|
|
||||||
|
|
||||||
if (il_cfg->policy.softkey.title)
|
|
||||||
eina_stringshare_del(il_cfg->policy.softkey.title);
|
|
||||||
if (il_cfg->policy.softkey.class)
|
|
||||||
eina_stringshare_del(il_cfg->policy.softkey.class);
|
|
||||||
if (il_cfg->policy.softkey.name)
|
|
||||||
eina_stringshare_del(il_cfg->policy.softkey.name);
|
|
||||||
|
|
||||||
il_cfg->policy.softkey.title = eina_stringshare_add(title);
|
|
||||||
il_cfg->policy.softkey.class = eina_stringshare_add(class);
|
|
||||||
il_cfg->policy.softkey.name = eina_stringshare_add(name);
|
|
||||||
il_cfg->policy.softkey.win_type = wtype;
|
|
||||||
|
|
||||||
if (title) free(title);
|
|
||||||
if (name) free(name);
|
|
||||||
if (class) free(class);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_il_config_windows_indicator_selected(void *data, int type, void *event)
|
|
||||||
{
|
|
||||||
char *title, *name, *class;
|
|
||||||
Ecore_X_Window_Type wtype;
|
|
||||||
|
|
||||||
if (!selected_window) return 1;
|
|
||||||
title = ecore_x_icccm_title_get(selected_window);
|
|
||||||
ecore_x_icccm_name_class_get(selected_window, &name, &class);
|
|
||||||
ecore_x_netwm_window_type_get(selected_window, &wtype);
|
|
||||||
|
|
||||||
if (il_cfg->policy.indicator.title)
|
|
||||||
eina_stringshare_del(il_cfg->policy.indicator.title);
|
|
||||||
if (il_cfg->policy.indicator.class)
|
|
||||||
eina_stringshare_del(il_cfg->policy.indicator.class);
|
|
||||||
if (il_cfg->policy.indicator.name)
|
|
||||||
eina_stringshare_del(il_cfg->policy.indicator.name);
|
|
||||||
|
|
||||||
il_cfg->policy.indicator.title = eina_stringshare_add(title);
|
|
||||||
il_cfg->policy.indicator.class = eina_stringshare_add(class);
|
|
||||||
il_cfg->policy.indicator.name = eina_stringshare_add(name);
|
|
||||||
il_cfg->policy.indicator.win_type = wtype;
|
|
||||||
|
|
||||||
if (title) free(title);
|
|
||||||
if (name) free(name);
|
|
||||||
if (class) free(class);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#ifndef E_MOD_WINDOWS_H
|
#ifndef E_MOD_WINDOWS_H
|
||||||
#define E_MOD_WINDOWS_H
|
#define E_MOD_WINDOWS_H
|
||||||
|
|
||||||
EAPI void il_config_windows_show(E_Container *con, const char *params);
|
void il_config_windows_show(E_Container *con, const char *params);
|
||||||
|
|
||||||
extern EAPI int IL_EVENT_WINDOW_SELECTED;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue