summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am3
-rw-r--r--src/actions.c72
-rw-r--r--src/border.c24
-rw-r--r--src/e.h5
-rw-r--r--src/icons.c4
-rw-r--r--src/keys.c56
-rw-r--r--src/main.c1
7 files changed, 159 insertions, 6 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 8fb84f5a9..944508126 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,6 +18,7 @@ fs.c \
18icccm.c \ 18icccm.c \
19icons.c \ 19icons.c \
20ipc.c \ 20ipc.c \
21keys.c \
21main.c \ 22main.c \
22menu.c \ 23menu.c \
23menudb.c \ 24menudb.c \
@@ -28,5 +29,5 @@ util.c \
28view.c \ 29view.c \
29e.h 30e.h
30 31
31enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ -lm $(INTLLIBS) $(LDADD_FLAGS) 32enlightenment_LDADD = @evas_libs@ @edb_libs@ @ebits_libs@ @ecore_libs@ @efsd_libs@ -lm $(INTLLIBS)
32 33
diff --git a/src/actions.c b/src/actions.c
index 909fbc826..314dd23d0 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -124,6 +124,16 @@ _e_action_find(char *action, int act, int button, char *key, Ev_Key_Modifiers mo
124 a->object = NULL; 124 a->object = NULL;
125 a->started = 0; 125 a->started = 0;
126 actions = evas_list_append(actions, a); 126 actions = evas_list_append(actions, a);
127 /* it's a key? lets grab it! */
128 if ((a->key) && (strlen(a->key) > 0))
129 {
130 printf("grab it! (%s %i)\n", a->key, a->modifiers);
131 if (a->modifiers == -1)
132 e_keys_grab(a->key, EV_KEY_MODIFIER_NONE, 1);
133 else
134 e_keys_grab(a->key, (Ev_Key_Modifiers)a->modifiers, 0);
135 a->grabbed = 1;
136 }
127 } 137 }
128 error: 138 error:
129 e_db_close(db); 139 e_db_close(db);
@@ -185,6 +195,15 @@ _e_action_find(char *action, int act, int button, char *key, Ev_Key_Modifiers mo
185static void 195static void
186_e_action_free(E_Action *a) 196_e_action_free(E_Action *a)
187{ 197{
198 /* it's a key? lets ungrab it! */
199 if ((a->key) && (strlen(a->key) > 0) && (a->grabbed))
200 {
201 printf("ungrab it! (%s %i)\n", a->key, a->modifiers);
202 if (a->modifiers == -1)
203 e_keys_ungrab(a->key, EV_KEY_MODIFIER_NONE, 1);
204 else
205 e_keys_ungrab(a->key, (Ev_Key_Modifiers)a->modifiers, 0);
206 }
188 IF_FREE(a->name); 207 IF_FREE(a->name);
189 IF_FREE(a->action); 208 IF_FREE(a->action);
190 IF_FREE(a->params); 209 IF_FREE(a->params);
@@ -466,6 +485,8 @@ e_act_move_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry
466 E_Border *b; 485 E_Border *b;
467 486
468 b = o; 487 b = o;
488 if (!b) b = e_border_current_focused();
489 if (!b) return;
469 b->mode.move = 1; 490 b->mode.move = 1;
470 b->current.requested.dx = 0; 491 b->current.requested.dx = 0;
471 b->current.requested.dy = 0; 492 b->current.requested.dy = 0;
@@ -486,6 +507,8 @@ e_act_move_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int ry
486 E_Border *b; 507 E_Border *b;
487 508
488 b = o; 509 b = o;
510 if (!b) b = e_border_current_focused();
511 if (!b) return;
489 b->current.requested.x = b->current.x; 512 b->current.requested.x = b->current.x;
490 b->current.requested.y = b->current.y; 513 b->current.requested.y = b->current.y;
491 b->changed = 1; 514 b->changed = 1;
@@ -510,6 +533,8 @@ e_act_move_go (void *o, E_Action *a, void *data, int x, int y, int rx, int ry
510 E_Border *b; 533 E_Border *b;
511 534
512 b = o; 535 b = o;
536 if (!b) b = e_border_current_focused();
537 if (!b) return;
513 b->current.requested.x += dx; 538 b->current.requested.x += dx;
514 b->current.requested.y += dy; 539 b->current.requested.y += dy;
515 if (dx != 0) b->current.requested.dx = dx; 540 if (dx != 0) b->current.requested.dx = dx;
@@ -532,6 +557,8 @@ e_act_resize_start (void *o, E_Action *a, void *data, int x, int y, int rx, int
532 E_Border *b; 557 E_Border *b;
533 558
534 b = o; 559 b = o;
560 if (!b) b = e_border_current_focused();
561 if (!b) return;
535 if (b->current.shaded != 0) return; 562 if (b->current.shaded != 0) return;
536 /* 0 | 1 */ 563 /* 0 | 1 */
537 /* --+-- */ 564 /* --+-- */
@@ -575,6 +602,8 @@ e_act_resize_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int
575 E_Border *b; 602 E_Border *b;
576 603
577 b = o; 604 b = o;
605 if (!b) b = e_border_current_focused();
606 if (!b) return;
578 if (b->current.shaded != 0) return; 607 if (b->current.shaded != 0) return;
579 b->current.requested.x = b->current.x; 608 b->current.requested.x = b->current.x;
580 b->current.requested.y = b->current.y; 609 b->current.requested.y = b->current.y;
@@ -598,6 +627,8 @@ e_act_resize_go (void *o, E_Action *a, void *data, int x, int y, int rx, int
598 E_Border *b; 627 E_Border *b;
599 628
600 b = o; 629 b = o;
630 if (!b) b = e_border_current_focused();
631 if (!b) return;
601 if (b->current.shaded != 0) return; 632 if (b->current.shaded != 0) return;
602 if (b->mode.resize == 0) 633 if (b->mode.resize == 0)
603 { 634 {
@@ -641,6 +672,8 @@ e_act_resize_h_start (void *o, E_Action *a, void *data, int x, int y, int rx, in
641 E_Border *b; 672 E_Border *b;
642 673
643 b = o; 674 b = o;
675 if (!b) b = e_border_current_focused();
676 if (!b) return;
644 if (b->current.shaded != 0) return; 677 if (b->current.shaded != 0) return;
645 /* 4 | 5 */ 678 /* 4 | 5 */
646 if (x > (b->current.w / 2)) 679 if (x > (b->current.w / 2))
@@ -667,6 +700,8 @@ e_act_resize_h_stop (void *o, E_Action *a, void *data, int x, int y, int rx, in
667 E_Border *b; 700 E_Border *b;
668 701
669 b = o; 702 b = o;
703 if (!b) b = e_border_current_focused();
704 if (!b) return;
670 if (b->current.shaded != 0) return; 705 if (b->current.shaded != 0) return;
671 b->current.requested.x = b->current.x; 706 b->current.requested.x = b->current.x;
672 b->current.requested.y = b->current.y; 707 b->current.requested.y = b->current.y;
@@ -690,6 +725,8 @@ e_act_resize_h_go (void *o, E_Action *a, void *data, int x, int y, int rx, in
690 E_Border *b; 725 E_Border *b;
691 726
692 b = o; 727 b = o;
728 if (!b) b = e_border_current_focused();
729 if (!b) return;
693 if (b->current.shaded != 0) return; 730 if (b->current.shaded != 0) return;
694 if (b->mode.resize == 4) 731 if (b->mode.resize == 4)
695 { 732 {
@@ -719,6 +756,8 @@ e_act_resize_v_start (void *o, E_Action *a, void *data, int x, int y, int rx, in
719 E_Border *b; 756 E_Border *b;
720 757
721 b = o; 758 b = o;
759 if (!b) b = e_border_current_focused();
760 if (!b) return;
722 if (b->current.shaded != 0) return; 761 if (b->current.shaded != 0) return;
723 /* 6 */ 762 /* 6 */
724 /* - */ 763 /* - */
@@ -747,6 +786,8 @@ e_act_resize_v_stop (void *o, E_Action *a, void *data, int x, int y, int rx, in
747 E_Border *b; 786 E_Border *b;
748 787
749 b = o; 788 b = o;
789 if (!b) b = e_border_current_focused();
790 if (!b) return;
750 if (b->current.shaded != 0) return; 791 if (b->current.shaded != 0) return;
751 b->current.requested.x = b->current.x; 792 b->current.requested.x = b->current.x;
752 b->current.requested.y = b->current.y; 793 b->current.requested.y = b->current.y;
@@ -770,6 +811,8 @@ e_act_resize_v_go (void *o, E_Action *a, void *data, int x, int y, int rx, in
770 E_Border *b; 811 E_Border *b;
771 812
772 b = o; 813 b = o;
814 if (!b) b = e_border_current_focused();
815 if (!b) return;
773 if (b->current.shaded != 0) return; 816 if (b->current.shaded != 0) return;
774 if (b->mode.resize == 6) 817 if (b->mode.resize == 6)
775 { 818 {
@@ -799,6 +842,8 @@ e_act_close_start (void *o, E_Action *a, void *data, int x, int y, int rx, int r
799 E_Border *b; 842 E_Border *b;
800 843
801 b = o; 844 b = o;
845 if (!b) b = e_border_current_focused();
846 if (!b) return;
802 if (b->win.client) e_icccm_delete(b->win.client); 847 if (b->win.client) e_icccm_delete(b->win.client);
803 return; 848 return;
804 UN(a); 849 UN(a);
@@ -816,6 +861,8 @@ e_act_kill_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry
816 E_Border *b; 861 E_Border *b;
817 862
818 b = o; 863 b = o;
864 if (!b) b = e_border_current_focused();
865 if (!b) return;
819 if (b->win.client) e_window_kill_client(b->win.client); 866 if (b->win.client) e_window_kill_client(b->win.client);
820 return; 867 return;
821 UN(a); 868 UN(a);
@@ -837,6 +884,8 @@ e_act_cb_shade(int val, void *data)
837 int pix_per_sec = 3200; 884 int pix_per_sec = 3200;
838 885
839 b = data; 886 b = data;
887 if (!b) b = e_border_current_focused();
888 if (!b) return;
840 if (val == 0) 889 if (val == 0)
841 { 890 {
842 OBJ_REF(b); 891 OBJ_REF(b);
@@ -875,6 +924,8 @@ e_act_cb_unshade(int val, void *data)
875 int pix_per_sec = 3200; 924 int pix_per_sec = 3200;
876 925
877 b = data; 926 b = data;
927 if (!b) b = e_border_current_focused();
928 if (!b) return;
878 if (val == 0) 929 if (val == 0)
879 { 930 {
880 OBJ_REF(b); 931 OBJ_REF(b);
@@ -909,6 +960,8 @@ e_act_shade_start (void *o, E_Action *a, void *data, int x, int y, int rx, int r
909 E_Border *b; 960 E_Border *b;
910 961
911 b = o; 962 b = o;
963 if (!b) b = e_border_current_focused();
964 if (!b) return;
912 if (b->current.shaded == 0) e_act_cb_shade(0, b); 965 if (b->current.shaded == 0) e_act_cb_shade(0, b);
913 else e_act_cb_unshade(0, b); 966 else e_act_cb_unshade(0, b);
914 return; 967 return;
@@ -927,6 +980,8 @@ e_act_raise_start (void *o, E_Action *a, void *data, int x, int y, int rx, int r
927 E_Border *b; 980 E_Border *b;
928 981
929 b = o; 982 b = o;
983 if (!b) b = e_border_current_focused();
984 if (!b) return;
930 e_border_raise(b); 985 e_border_raise(b);
931 return; 986 return;
932 UN(a); 987 UN(a);
@@ -944,6 +999,8 @@ e_act_lower_start (void *o, E_Action *a, void *data, int x, int y, int rx, int r
944 E_Border *b; 999 E_Border *b;
945 1000
946 b = o; 1001 b = o;
1002 if (!b) b = e_border_current_focused();
1003 if (!b) return;
947 e_border_lower(b); 1004 e_border_lower(b);
948 return; 1005 return;
949 UN(a); 1006 UN(a);
@@ -961,6 +1018,8 @@ e_act_raise_lower_start (void *o, E_Action *a, void *data, int x, int y, int rx,
961 E_Border *b; 1018 E_Border *b;
962 1019
963 b = o; 1020 b = o;
1021 if (!b) b = e_border_current_focused();
1022 if (!b) return;
964 return; 1023 return;
965 UN(a); 1024 UN(a);
966 UN(data); 1025 UN(data);
@@ -993,6 +1052,8 @@ e_act_menu_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry
993 E_Border *b; 1052 E_Border *b;
994 1053
995 b = o; 1054 b = o;
1055 if (!b) b = e_border_current_focused();
1056 if (!b) return;
996 return; 1057 return;
997 UN(a); 1058 UN(a);
998 UN(data); 1059 UN(data);
@@ -1043,6 +1104,8 @@ e_act_stick_start (void *o, E_Action *a, void *data, int x, int y, int rx, int r
1043 E_Border *b; 1104 E_Border *b;
1044 1105
1045 b = o; 1106 b = o;
1107 if (!b) b = e_border_current_focused();
1108 if (!b) return;
1046 if (b->client.sticky) b->client.sticky = 0; 1109 if (b->client.sticky) b->client.sticky = 0;
1047 else b->client.sticky = 1; 1110 else b->client.sticky = 1;
1048 b->changed = 1; 1111 b->changed = 1;
@@ -1078,6 +1141,8 @@ e_act_iconify_start (void *o, E_Action *a, void *data, int x, int y, int rx, int
1078 E_Border *b; 1141 E_Border *b;
1079 1142
1080 b = o; 1143 b = o;
1144 if (!b) b = e_border_current_focused();
1145 if (!b) return;
1081 return; 1146 return;
1082 UN(a); 1147 UN(a);
1083 UN(data); 1148 UN(data);
@@ -1094,6 +1159,9 @@ e_act_max_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry)
1094 E_Border *b; 1159 E_Border *b;
1095 1160
1096 b = o; 1161 b = o;
1162 printf("e_act_max_start\n");
1163 if (!b) b = e_border_current_focused();
1164 if (!b) return;
1097 if (b->current.shaded > 0) return; 1165 if (b->current.shaded > 0) return;
1098 if ((b->mode.move) || (b->mode.resize)) return; 1166 if ((b->mode.move) || (b->mode.resize)) return;
1099 b->mode.move = 0; 1167 b->mode.move = 0;
@@ -1146,6 +1214,8 @@ e_act_snap_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry
1146 E_Border *b; 1214 E_Border *b;
1147 1215
1148 b = o; 1216 b = o;
1217 if (!b) b = e_border_current_focused();
1218 if (!b) return;
1149 return; 1219 return;
1150 UN(a); 1220 UN(a);
1151 UN(data); 1221 UN(data);
@@ -1162,6 +1232,8 @@ e_act_zoom_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry
1162 E_Border *b; 1232 E_Border *b;
1163 1233
1164 b = o; 1234 b = o;
1235 if (!b) b = e_border_current_focused();
1236 if (!b) return;
1165 return; 1237 return;
1166 UN(a); 1238 UN(a);
1167 UN(data); 1239 UN(data);
diff --git a/src/border.c b/src/border.c
index b3de4dcc7..be2d62838 100644
--- a/src/border.c
+++ b/src/border.c
@@ -385,6 +385,7 @@ e_focus_in(Eevent * ev)
385 if (b) 385 if (b)
386 { 386 {
387 b->current.selected = 1; 387 b->current.selected = 1;
388 if (e->key_grab) b->current.select_lost_from_grab = 0;
388 b->changed = 1; 389 b->changed = 1;
389 } 390 }
390 } 391 }
@@ -413,6 +414,7 @@ e_focus_out(Eevent * ev)
413 414
414 E_CONFIG_INT_GET(cfg_focus_mode, focus_mode); 415 E_CONFIG_INT_GET(cfg_focus_mode, focus_mode);
415 b->current.selected = 0; 416 b->current.selected = 0;
417 if (e->key_grab) b->current.select_lost_from_grab = 1;
416 /* settings - click to focus would affect grabs */ 418 /* settings - click to focus would affect grabs */
417 if (!b->current.selected) 419 if (!b->current.selected)
418 { 420 {
@@ -2105,3 +2107,25 @@ e_border_adopt_children(Window win)
2105 free(wins); 2107 free(wins);
2106 } 2108 }
2107} 2109}
2110
2111E_Border *
2112e_border_current_focused(void)
2113{
2114 Evas_List l;
2115
2116 for (l = borders; l; l = l->next)
2117 {
2118 E_Border *b;
2119
2120 b = l->data;
2121 if (b->current.selected) return b;
2122 }
2123 for (l = borders; l; l = l->next)
2124 {
2125 E_Border *b;
2126
2127 b = l->data;
2128 if (b->current.select_lost_from_grab) return b;
2129 }
2130 return NULL;
2131}
diff --git a/src/e.h b/src/e.h
index b7132080d..bec052de4 100644
--- a/src/e.h
+++ b/src/e.h
@@ -191,6 +191,7 @@ struct _E_Border
191 int x, y, w, h; 191 int x, y, w, h;
192 int visible; 192 int visible;
193 int selected; 193 int selected;
194 int select_lost_from_grab;
194 int shaded; 195 int shaded;
195 int has_shape; 196 int has_shape;
196 int shape_changes; 197 int shape_changes;
@@ -267,6 +268,7 @@ struct _E_Action
267 E_Action_Proto *action_proto; 268 E_Action_Proto *action_proto;
268 void *object; 269 void *object;
269 int started; 270 int started;
271 int grabbed;
270}; 272};
271 273
272struct _E_Action_Proto 274struct _E_Action_Proto
@@ -713,7 +715,8 @@ void e_border_raise_above(E_Border *b, E_Border *above);
713void e_border_lower_below(E_Border *b, E_Border *below); 715void e_border_lower_below(E_Border *b, E_Border *below);
714void e_border_init(void); 716void e_border_init(void);
715void e_border_adopt_children(Window win); 717void e_border_adopt_children(Window win);
716 718E_Border *e_border_current_focused(void);
719
717void e_icccm_move_resize(Window win, int x, int y, int w, int h); 720void e_icccm_move_resize(Window win, int x, int y, int w, int h);
718void e_icccm_delete(Window win); 721void e_icccm_delete(Window win);
719void e_icccm_state_mapped(Window win); 722void e_icccm_state_mapped(Window win);
diff --git a/src/icons.c b/src/icons.c
index 47e005f1e..c4ed447a8 100644
--- a/src/icons.c
+++ b/src/icons.c
@@ -99,7 +99,6 @@ e_icon_place_grid(E_Icon *icon)
99 x += (icon->view->options.arrange.grid.w - icon->current.w) / 2; 99 x += (icon->view->options.arrange.grid.w - icon->current.w) / 2;
100 y += (icon->view->options.arrange.grid.h - icon->current.h); 100 y += (icon->view->options.arrange.grid.h - icon->current.h);
101 e_icon_set_xy(icon, x, y); 101 e_icon_set_xy(icon, x, y);
102 printf("GRID PLACE at %i %i\n", x, y);
103 icon->view->options.arrange.grid.next_pos++; 102 icon->view->options.arrange.grid.next_pos++;
104 } 103 }
105 else /* v */ 104 else /* v */
@@ -113,7 +112,6 @@ e_icon_pre_show(E_Icon *icon)
113 int x, y; 112 int x, y;
114 113
115 if (icon->info.ready) return; 114 if (icon->info.ready) return;
116 printf("*********!!!!!!!!!!!!!!!********* update from e_icon_pre_show()\n");
117 e_icon_update(icon); 115 e_icon_update(icon);
118 icon->info.ready = 1; 116 icon->info.ready = 1;
119 if (icon->info.coord.have) 117 if (icon->info.coord.have)
@@ -291,7 +289,6 @@ e_icon_update(E_Icon *icon)
291 int obj_new = 0; 289 int obj_new = 0;
292 290
293 if (!icon->changed) return; 291 if (!icon->changed) return;
294 printf("icon (%s).. update\n", icon->file);
295 if (icon->current.state.clicked) 292 if (icon->current.state.clicked)
296 { 293 {
297 if (icon->info.icon.clicked) 294 if (icon->info.icon.clicked)
@@ -417,5 +414,4 @@ e_icon_update(E_Icon *icon)
417 icon->previous = icon->current; 414 icon->previous = icon->current;
418 icon->previous.icon = strdup(icon->current.icon); 415 icon->previous.icon = strdup(icon->current.icon);
419 icon->changed = 0; 416 icon->changed = 0;
420 printf("... done\n");
421} 417}
diff --git a/src/keys.c b/src/keys.c
new file mode 100644
index 000000000..902f8dc77
--- /dev/null
+++ b/src/keys.c
@@ -0,0 +1,56 @@
1#include "e.h"
2
3static void e_key_down(Eevent * ev);
4static void e_key_up(Eevent * ev);
5
6static void
7e_key_down(Eevent * ev)
8{
9 Ev_Key_Down *e;
10
11 e = ev->event;
12 if (e->win == e_get_key_grab_win())
13 {
14 e_action_stop("Key_Binding", ACT_KEY_DOWN, 0, e->key, e->mods,
15 NULL, NULL, 0, 0, 0, 0);
16 e_action_start("Key_Binding", ACT_KEY_DOWN, 0, e->key, e->mods,
17 NULL, NULL, 0, 0, 0, 0);
18 }
19}
20
21static void
22e_key_up(Eevent * ev)
23{
24 Ev_Key_Up *e;
25
26 e = ev->event;
27 if (e->win == e_get_key_grab_win())
28 {
29 e_action_stop("Key_Binding", ACT_KEY_UP, 0, e->key, e->mods,
30 NULL, NULL, 0, 0, 0, 0);
31 e_action_start("Key_Binding", ACT_KEY_UP, 0, e->key, e->mods,
32 NULL, NULL, 0, 0, 0, 0);
33 }
34}
35
36void
37e_keys_init(void)
38{
39 /* load up our actions .... once to get some grabbed keys */
40 e_action_start("", ACT_KEY_DOWN, 0, NULL, EV_KEY_MODIFIER_NONE,
41 NULL, NULL, 0, 0, 0, 0);
42 e_event_filter_handler_add(EV_KEY_DOWN, e_key_down);
43 e_event_filter_handler_add(EV_KEY_UP, e_key_up);
44}
45
46void
47e_keys_grab(char *key, Ev_Key_Modifiers mods, int anymod)
48{
49 e_key_grab(key, mods, anymod, 0);
50}
51
52void
53e_keys_ungrab(char *key, Ev_Key_Modifiers mods, int anymod)
54{
55 e_key_ungrab(key, mods, anymod);
56}
diff --git a/src/main.c b/src/main.c
index 9368ef662..80567469a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -56,6 +56,7 @@ main(int argc, char **argv)
56 e_view_init(); 56 e_view_init();
57 e_entry_init(); 57 e_entry_init();
58 e_ipc_init(); 58 e_ipc_init();
59 e_keys_init();
59 60
60 setup(); 61 setup();
61 62