Commit 6d9cb588bb9fa9e5035b76edc2336230c3ce8c7a
1 parent
846ee516
Exists in
master
and in
5 other branches
Incluindo ações que precisam de tratamento especial
Showing
2 changed files
with
35 additions
and
9 deletions
Show diff stats
src/gtk/globals.h
src/gtk/mainwindow.c
... | ... | @@ -75,6 +75,7 @@ |
75 | 75 | }; |
76 | 76 | |
77 | 77 | static const gchar *actionname[ACTION_COUNT+1] = { "pastenext", |
78 | + "reselect", | |
78 | 79 | "setfullscreen", |
79 | 80 | "resetfullscreen" |
80 | 81 | }; |
... | ... | @@ -88,14 +89,6 @@ |
88 | 89 | |
89 | 90 | if(id == LIB3270_TOGGLE_FULL_SCREEN) |
90 | 91 | { |
91 | - GtkAction **action = (GtkAction **) g_object_get_data(G_OBJECT(toplevel),"named_actions"); | |
92 | - | |
93 | - if(action[ACTION_FULLSCREEN]) | |
94 | - gtk_action_set_visible(action[ACTION_FULLSCREEN],!toggled); | |
95 | - | |
96 | - if(action[ACTION_UNFULLSCREEN]) | |
97 | - gtk_action_set_visible(action[ACTION_UNFULLSCREEN],toggled); | |
98 | - | |
99 | 92 | if(toggled) |
100 | 93 | gtk_window_fullscreen(GTK_WINDOW(toplevel)); |
101 | 94 | else |
... | ... | @@ -106,6 +99,23 @@ |
106 | 99 | |
107 | 100 | } |
108 | 101 | |
102 | + static gboolean window_state_event(GtkWidget *window, GdkEventWindowState *event, GtkWidget *widget) | |
103 | + { | |
104 | + gboolean fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN ? TRUE : FALSE; | |
105 | + GtkAction **action = (GtkAction **) g_object_get_data(G_OBJECT(window),"named_actions"); | |
106 | + | |
107 | + // Update fullscreen toggles | |
108 | + if(action[ACTION_FULLSCREEN]) | |
109 | + gtk_action_set_visible(action[ACTION_FULLSCREEN],!fullscreen); | |
110 | + | |
111 | + if(action[ACTION_UNFULLSCREEN]) | |
112 | + gtk_action_set_visible(action[ACTION_UNFULLSCREEN],fullscreen); | |
113 | + | |
114 | + lib3270_set_toggle(v3270_get_session(widget),LIB3270_TOGGLE_FULL_SCREEN,fullscreen); | |
115 | + | |
116 | + return 0; | |
117 | + } | |
118 | + | |
109 | 119 | static void disconnected(GtkWidget *widget, GtkActionGroup **group) |
110 | 120 | { |
111 | 121 | gtk_action_group_set_sensitive(group[ACTION_GROUP_ONLINE],FALSE); |
... | ... | @@ -158,8 +168,12 @@ |
158 | 168 | |
159 | 169 | static void selecting(GtkWidget *widget, gboolean on, GtkActionGroup **group) |
160 | 170 | { |
161 | -// trace("Widget %p selection state changed to %s",widget,on ? "Yes" : "No"); | |
171 | + GtkAction **action = (GtkAction **) g_object_get_data(G_OBJECT(widget),"named_actions"); | |
162 | 172 | gtk_action_group_set_sensitive(group[ACTION_GROUP_SELECTION],on); |
173 | + | |
174 | + if(action[ACTION_RESELECT]) | |
175 | + gtk_action_set_sensitive(action[ACTION_RESELECT],!on); | |
176 | + | |
163 | 177 | } |
164 | 178 | |
165 | 179 | static void setup_input_method(GtkWidget *widget, GtkWidget *obj) |
... | ... | @@ -268,6 +282,8 @@ |
268 | 282 | popup = g_object_get_data(G_OBJECT(window),"popup_menus"); |
269 | 283 | action = (GtkAction **) g_object_get_data(G_OBJECT(window),"named_actions"); |
270 | 284 | |
285 | + g_object_set_data(G_OBJECT(terminal),"named_actions",action); | |
286 | + | |
271 | 287 | // Setup action groups |
272 | 288 | gtk_action_group_set_sensitive(group[ACTION_GROUP_SELECTION],FALSE); |
273 | 289 | gtk_action_group_set_sensitive(group[ACTION_GROUP_CLIPBOARD],FALSE); |
... | ... | @@ -282,6 +298,15 @@ |
282 | 298 | if(action[ACTION_UNFULLSCREEN]) |
283 | 299 | gtk_action_set_visible(action[ACTION_UNFULLSCREEN],lib3270_get_toggle(host,LIB3270_TOGGLE_FULL_SCREEN)); |
284 | 300 | |
301 | + if(action[ACTION_PASTENEXT]) | |
302 | + gtk_action_set_sensitive(action[ACTION_PASTENEXT],FALSE); | |
303 | + | |
304 | + if(action[ACTION_RESELECT]) | |
305 | + gtk_action_set_sensitive(action[ACTION_RESELECT],FALSE); | |
306 | + | |
307 | + // Connect window signals | |
308 | + g_signal_connect(window,"window_state_event",G_CALLBACK(window_state_event),terminal); | |
309 | + | |
285 | 310 | // Connect widget signals |
286 | 311 | g_signal_connect(terminal,"toggle_changed",G_CALLBACK(toggle_changed),window); |
287 | 312 | g_signal_connect(terminal,"disconnected",G_CALLBACK(disconnected),group); | ... | ... |