about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-04-30 23:38:28 +0100
committerJames Booth <boothj5@gmail.com>2015-04-30 23:38:28 +0100
commit0bd642edf8d943485871082c2678b0662e1dd5db (patch)
treeb5ed09aceb749904eaa546333130c804f9f87f66 /src/ui
parenta3a4b6267b02d69761e64403aa131553c946fa96 (diff)
parente11e55e31abced2f4e7fa332298485562adaf1ef (diff)
downloadprofani-tty-0bd642edf8d943485871082c2678b0662e1dd5db.tar.gz
Merge branch 'master' into pgp
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/core.c77
-rw-r--r--src/ui/inputwin.c14
-rw-r--r--src/ui/ui.h2
-rw-r--r--src/ui/windows.c7
4 files changed, 23 insertions, 77 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 22cf1168..946e3eaf 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -74,6 +74,7 @@
 #include "ui/window.h"
 #include "ui/windows.h"
 #include "xmpp/xmpp.h"
+#include "event/ui_events.h"
 
 static char *win_title;
 
@@ -894,64 +895,6 @@ ui_switch_win(ProfWin *window)
 }
 
 void
-ui_previous_win(void)
-{
-    ProfWin *old_current = wins_get_current();
-    if (old_current->type == WIN_MUC_CONFIG) {
-        ProfMucConfWin *confwin = (ProfMucConfWin*)old_current;
-        cmd_autocomplete_remove_form_fields(confwin->form);
-    }
-
-    ProfWin *new_current = wins_get_previous();
-    if (new_current->type == WIN_MUC_CONFIG) {
-        ProfMucConfWin *confwin = (ProfMucConfWin*)new_current;
-        cmd_autocomplete_add_form_fields(confwin->form);
-    }
-
-    int i = wins_get_num(new_current);
-    wins_set_current_by_num(i);
-
-    if (i == 1) {
-        title_bar_console();
-        status_bar_current(1);
-        status_bar_active(1);
-    } else {
-        title_bar_switch();
-        status_bar_current(i);
-        status_bar_active(i);
-    }
-}
-
-void
-ui_next_win(void)
-{
-    ProfWin *old_current = wins_get_current();
-    if (old_current->type == WIN_MUC_CONFIG) {
-        ProfMucConfWin *confwin = (ProfMucConfWin*)old_current;
-        cmd_autocomplete_remove_form_fields(confwin->form);
-    }
-
-    ProfWin *new_current = wins_get_next();
-    if (new_current->type == WIN_MUC_CONFIG) {
-        ProfMucConfWin *confwin = (ProfMucConfWin*)new_current;
-        cmd_autocomplete_add_form_fields(confwin->form);
-    }
-
-    int i = wins_get_num(new_current);
-    wins_set_current_by_num(i);
-
-    if (i == 1) {
-        title_bar_console();
-        status_bar_current(1);
-        status_bar_active(1);
-    } else {
-        title_bar_switch();
-        status_bar_current(i);
-        status_bar_active(i);
-    }
-}
-
-void
 ui_gone_secure(const char * const barejid, gboolean trusted)
 {
     ProfWin *window = NULL;
@@ -1348,14 +1291,14 @@ ui_new_private_win(const char * const fulljid)
     if (!window) {
         window = wins_new_private(fulljid);
     }
-    ui_switch_win(window);
+    ui_ev_focus_win(window);
 }
 
 void
 ui_create_xmlconsole_win(void)
 {
     ProfWin *window = wins_new_xmlconsole();
-    ui_switch_win(window);
+    ui_ev_focus_win(window);
 }
 
 void
@@ -1363,7 +1306,7 @@ ui_open_xmlconsole_win(void)
 {
     ProfXMLWin *xmlwin = wins_get_xmlconsole();
     if (xmlwin) {
-        ui_switch_win((ProfWin*)xmlwin);
+        ui_ev_focus_win((ProfWin*)xmlwin);
     }
 }
 
@@ -1435,7 +1378,7 @@ ui_outgoing_private_msg(const char * const fulljid, const char * const message)
     }
 
     win_print(window, '-', NULL, 0, THEME_TEXT_ME, "me", message);
-    ui_switch_win(window);
+    ui_ev_focus_win(window);
 }
 
 void
@@ -1462,7 +1405,7 @@ ui_room_join(const char * const roomjid, gboolean focus)
 
 
     if (focus) {
-        ui_switch_win(window);
+        ui_ev_focus_win(window);
     } else {
         int num = wins_get_num(window);
         status_bar_active(num);
@@ -1476,7 +1419,7 @@ void
 ui_switch_to_room(const char * const roomjid)
 {
     ProfWin *window = (ProfWin*)wins_get_muc(roomjid);
-    ui_switch_win(window);
+    ui_ev_focus_win(window);
 }
 
 void
@@ -2648,7 +2591,7 @@ ui_handle_room_configuration(const char * const roomjid, DataForm *form)
     ProfMucConfWin *confwin = (ProfMucConfWin*)window;
     assert(confwin->memcheck == PROFCONFWIN_MEMCHECK);
 
-    ui_switch_win(window);
+    ui_ev_focus_win(window);
     ui_show_form(confwin);
 
     win_print(window, '-', NULL, 0, 0, "", "");
@@ -2703,11 +2646,11 @@ ui_handle_room_config_submit_result(const char * const roomjid)
         }
 
         if (muc_window) {
-            ui_switch_win((ProfWin*)muc_window);
+            ui_ev_focus_win((ProfWin*)muc_window);
             win_print(muc_window, '!', NULL, 0, THEME_ROOMINFO, "", "Room configuration successful");
         } else {
             ProfWin *console = wins_get_console();
-            ui_switch_win(console);
+            ui_ev_focus_win(console);
             cons_show("Room configuration successful: %s", roomjid);
         }
     } else {
diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c
index 6cfbde47..caea8ea9 100644
--- a/src/ui/inputwin.c
+++ b/src/ui/inputwin.c
@@ -455,9 +455,7 @@ _go_to_win(int i)
 {
     ProfWin *window = wins_get_by_num(i);
     if (window) {
-        if (!wins_is_current(window)) {
-            ui_ev_focus_win(window);
-        }
+        ui_ev_focus_win(window);
     }
 }
 
@@ -534,14 +532,20 @@ _inp_rl_win0_handler(int count, int key)
 static int
 _inp_rl_altleft_handler(int count, int key)
 {
-    ui_previous_win();
+    ProfWin *window = wins_get_previous();
+    if (window) {
+        ui_ev_focus_win(window);
+    }
     return 0;
 }
 
 static int
 _inp_rl_altright_handler(int count, int key)
 {
-    ui_next_win();
+    ProfWin *window = wins_get_next();
+    if (window) {
+        ui_ev_focus_win(window);
+    }
     return 0;
 }
 
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 529e0f92..6d85c9e8 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -60,8 +60,6 @@ void ui_redraw(void);
 void ui_resize(void);
 GSList* ui_get_chat_recipients(void);
 void ui_switch_win(ProfWin *window);
-void ui_next_win(void);
-void ui_previous_win(void);
 void ui_sigwinch_handler(int sig);
 
 void ui_gone_secure(const char * const barejid, gboolean trusted);
diff --git a/src/ui/windows.c b/src/ui/windows.c
index 4cc0fef7..7a86403b 100644
--- a/src/ui/windows.c
+++ b/src/ui/windows.c
@@ -53,6 +53,7 @@
 #include "ui/statusbar.h"
 #include "ui/window.h"
 #include "ui/windows.h"
+#include "event/ui_events.h"
 
 static GHashTable *windows;
 static int current;
@@ -661,7 +662,7 @@ wins_swap(int source_win, int target_win)
             }
             if (wins_get_current_num() == source_win) {
                 wins_set_current_by_num(target_win);
-                ui_switch_win(console);
+                ui_ev_focus_win(console);
             }
             return TRUE;
 
@@ -682,7 +683,7 @@ wins_swap(int source_win, int target_win)
                 status_bar_active(source_win);
             }
             if ((wins_get_current_num() == source_win) || (wins_get_current_num() == target_win)) {
-                ui_switch_win(console);
+                ui_ev_focus_win(console);
             }
             return TRUE;
         }
@@ -742,7 +743,7 @@ wins_tidy(void)
         windows = new_windows;
         current = 1;
         ProfWin *console = wins_get_console();
-        ui_switch_win(console);
+        ui_ev_focus_win(console);
         g_list_free(keys);
         return TRUE;
     } else {
tp err handling to combine 3 funcs into 1' href='/gbmor/getwtxt/commit/svc/handlers.go?h=v0.4.4&id=824556ab9829e0ff369808621bacb5cccbee27e9'>824556a ^
1168570 ^



824556a ^
1168570 ^





824556a ^
90638ac ^

824556a ^




90638ac ^
824556a ^
90638ac ^



505c5d8 ^


37be25f ^

505c5d8 ^
90638ac ^
37be25f ^

4f0847b ^
90638ac ^
37be25f ^
a9d7d11 ^
505c5d8 ^
90638ac ^
a9d7d11 ^

824556a ^
a9d7d11 ^
505c5d8 ^
78f4d8a ^
505c5d8 ^


a6f47c0 ^

dec003b ^
1168570 ^
505c5d8 ^
f4eb1c7 ^
824556a ^


1168570 ^
1168570 ^



df1d1ef ^
1168570 ^



dec003b ^

824556a ^
dec003b ^

1168570 ^
90638ac ^
dec003b ^

a6f47c0 ^

dec003b ^
1168570 ^
dec003b ^
f4eb1c7 ^
824556a ^
1168570 ^







1168570 ^


eca8525 ^
90638ac ^
1168570 ^

a6f47c0 ^

1168570 ^
a6f47c0 ^
eca8525 ^
1168570 ^
824556a ^
1168570 ^




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208