Merge lp:~skokec/dockbar/win7ish-feel into lp:dockbar
- win7ish-feel
- Merge into experimental
Proposed by
skokec
Status: | Needs review |
---|---|
Proposed branch: | lp:~skokec/dockbar/win7ish-feel |
Merge into: | lp:dockbar |
Diff against target: |
1548 lines (+532/-292) 7 files modified
dbx_preference.py (+61/-6) dockbarx/cairowidgets.py (+0/-1) dockbarx/common.py (+31/-26) dockbarx/dockbar.py (+8/-7) dockbarx/groupbutton.py (+370/-181) dockbarx/iconfactory.py (+7/-13) dockbarx/windowbutton.py (+55/-58) |
To merge this branch: | bzr merge lp:~skokec/dockbar/win7ish-feel |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Dockbar Main Group | Pending | ||
Review via email: mp+29224@code.launchpad.net |
Commit message
Description of the change
Added some options that mimic some of the behavior of win7 taskbar.
To post a comment you must log in.
Unmerged revisions
- 234. By Domen Tabernik
-
Merged new options for more win7 feel.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'dbx_preference.py' | |||
2 | --- dbx_preference.py 2010-06-21 04:19:21 +0000 | |||
3 | +++ dbx_preference.py 2010-07-05 16:50:40 +0000 | |||
4 | @@ -1,4 +1,4 @@ | |||
6 | 1 | #!/usr/bin/python | 1 | #!/usr/bin/python2.6 |
7 | 2 | 2 | ||
8 | 3 | # dbx_preference.py | 3 | # dbx_preference.py |
9 | 4 | # | 4 | # |
10 | @@ -274,6 +274,24 @@ | |||
11 | 274 | table.attach(label, 0, 1, row, row + 1, xpadding = 5) | 274 | table.attach(label, 0, 1, row, row + 1, xpadding = 5) |
12 | 275 | table.attach(self.wb_combos[text], 1, 2, row, row + 1 ) | 275 | table.attach(self.wb_combos[text], 1, 2, row, row + 1 ) |
13 | 276 | 276 | ||
14 | 277 | |||
15 | 278 | self.gb_close_popup_on_click_checkbutton_names = ['windowbutton_close_popup_on_left_click', | ||
16 | 279 | 'windowbutton_close_popup_on_shift_and_left_click', | ||
17 | 280 | 'windowbutton_close_popup_on_middle_click', | ||
18 | 281 | 'windowbutton_close_popup_on_shift_and_middle_click', | ||
19 | 282 | 'windowbutton_close_popup_on_right_click', | ||
20 | 283 | 'windowbutton_close_popup_on_shift_and_right_click', | ||
21 | 284 | 'windowbutton_close_popup_on_scroll_up', | ||
22 | 285 | 'windowbutton_close_popup_on_scroll_down'] | ||
23 | 286 | self.gb_close_popup_on_click_checkbutton = {} | ||
24 | 287 | |||
25 | 288 | for i in range(len(self.gb_close_popup_on_click_checkbutton_names)): | ||
26 | 289 | name = self.gb_close_popup_on_click_checkbutton_names[i] | ||
27 | 290 | self.gb_close_popup_on_click_checkbutton[name] = gtk.CheckButton('Close popup on click') | ||
28 | 291 | |||
29 | 292 | self.gb_close_popup_on_click_checkbutton[name].connect('toggled', self.checkbutton_toggled, name) | ||
30 | 293 | table.attach(self.gb_close_popup_on_click_checkbutton[name], 2, 3, i, i + 1, xpadding = 5 ) | ||
31 | 294 | |||
32 | 277 | hbox.pack_start(table, False) | 295 | hbox.pack_start(table, False) |
33 | 278 | frame.add(hbox) | 296 | frame.add(hbox) |
34 | 279 | windowbutton_box.pack_start(frame, False, padding=5) | 297 | windowbutton_box.pack_start(frame, False, padding=5) |
35 | @@ -385,6 +403,11 @@ | |||
36 | 385 | 'no_popup_for_one_window') | 403 | 'no_popup_for_one_window') |
37 | 386 | popup_box.pack_start(self.no_popup_cb, False, padding=5) | 404 | popup_box.pack_start(self.no_popup_cb, False, padding=5) |
38 | 387 | 405 | ||
39 | 406 | self.close_popup_on_click_cb = gtk.CheckButton('Close popup on any mouse click outside of focus (instead of when out of focus)') | ||
40 | 407 | self.close_popup_on_click_cb.connect('toggled', self.checkbutton_toggled, 'close_popup_on_click') | ||
41 | 408 | popup_box.pack_start(self.close_popup_on_click_cb, False, padding=5) | ||
42 | 409 | |||
43 | 410 | |||
44 | 388 | # Alignment | 411 | # Alignment |
45 | 389 | vbox = gtk.VBox() | 412 | vbox = gtk.VBox() |
46 | 390 | label1 = gtk.Label("<b><big>%s</big></b>"%_("Alignment")) | 413 | label1 = gtk.Label("<b><big>%s</big></b>"%_("Alignment")) |
47 | @@ -417,6 +440,17 @@ | |||
48 | 417 | spinbox.pack_start(spinlabel, False) | 440 | spinbox.pack_start(spinlabel, False) |
49 | 418 | spinbox.pack_start(self.delay_spin, False, padding=5) | 441 | spinbox.pack_start(self.delay_spin, False, padding=5) |
50 | 419 | vbox.pack_start(spinbox, False) | 442 | vbox.pack_start(spinbox, False) |
51 | 443 | |||
52 | 444 | spinbox = gtk.HBox() | ||
53 | 445 | spinlabel = gtk.Label("Second delay when already opened by first delay:") | ||
54 | 446 | spinlabel.set_alignment(0,0.5) | ||
55 | 447 | adj = gtk.Adjustment(0, 0, 2000, 1, 50) | ||
56 | 448 | self.delay_second_spin = gtk.SpinButton(adj, 0.5, 0) | ||
57 | 449 | adj.connect("value_changed", self.adjustment_changed, 'popup_delay_second') | ||
58 | 450 | spinbox.pack_start(spinlabel, False) | ||
59 | 451 | spinbox.pack_start(self.delay_second_spin, False, padding=5) | ||
60 | 452 | vbox.pack_start(spinbox, False) | ||
61 | 453 | |||
62 | 420 | popup_box.pack_start(vbox, False, padding=5) | 454 | popup_box.pack_start(vbox, False, padding=5) |
63 | 421 | 455 | ||
64 | 422 | # Previews | 456 | # Previews |
65 | @@ -440,7 +474,23 @@ | |||
66 | 440 | vbox.pack_start(spinbox, False) | 474 | vbox.pack_start(spinbox, False) |
67 | 441 | popup_box.pack_start(vbox, False, padding=5) | 475 | popup_box.pack_start(vbox, False, padding=5) |
68 | 442 | 476 | ||
70 | 443 | 477 | # On group button action | |
71 | 478 | vbox = gtk.VBox() | ||
72 | 479 | label2 = gtk.Label("<b>When group button is executed action:</b>") | ||
73 | 480 | label2.set_alignment(0,0.5) | ||
74 | 481 | label2.set_use_markup(True) | ||
75 | 482 | vbox.pack_start(label2,False) | ||
76 | 483 | |||
77 | 484 | self.disable_popup_on_gbbutton_click_cb = gtk.CheckButton('Disable popup delay if popup not opened') | ||
78 | 485 | self.disable_popup_on_gbbutton_click_cb.connect('toggled', self.checkbutton_toggled, 'disable_popup_on_groupbutton_click') | ||
79 | 486 | vbox.pack_start(self.disable_popup_on_gbbutton_click_cb, False) | ||
80 | 487 | |||
81 | 488 | self.close_popup_on_gbbutton_click_cb = gtk.CheckButton('Close popup if popup is opened (ignored on "show popup" action)') | ||
82 | 489 | self.close_popup_on_gbbutton_click_cb.connect('toggled', self.checkbutton_toggled, 'close_popup_on_groupbutton_click') | ||
83 | 490 | vbox.pack_start(self.close_popup_on_gbbutton_click_cb, False) | ||
84 | 491 | |||
85 | 492 | popup_box.pack_start(vbox, False, padding=5) | ||
86 | 493 | |||
87 | 444 | #--- Groupbutton page | 494 | #--- Groupbutton page |
88 | 445 | frame = gtk.Frame(_("Groupbutton actions")) | 495 | frame = gtk.Frame(_("Groupbutton actions")) |
89 | 446 | frame.set_border_width(5) | 496 | frame.set_border_width(5) |
90 | @@ -759,8 +809,11 @@ | |||
91 | 759 | 809 | ||
92 | 760 | # Popup | 810 | # Popup |
93 | 761 | self.delay_spin.set_value(self.globals.settings['popup_delay']) | 811 | self.delay_spin.set_value(self.globals.settings['popup_delay']) |
96 | 762 | self.no_popup_cb.set_active( | 812 | self.delay_second_spin.set_value(self.globals.settings['popup_delay_second']) |
97 | 763 | self.globals.settings['no_popup_for_one_window']) | 813 | self.no_popup_cb.set_active(self.globals.settings['no_popup_for_one_window']) |
98 | 814 | self.close_popup_on_click_cb.set_active(self.globals.settings['close_popup_on_click']) | ||
99 | 815 | self.disable_popup_on_gbbutton_click_cb.set_active(self.globals.settings['disable_popup_on_groupbutton_click']) | ||
100 | 816 | self.close_popup_on_gbbutton_click_cb.set_active(self.globals.settings['close_popup_on_groupbutton_click']) | ||
101 | 764 | 817 | ||
102 | 765 | # Group button keys | 818 | # Group button keys |
103 | 766 | for cb_name, setting_name in self.gb_labels_and_settings.items(): | 819 | for cb_name, setting_name in self.gb_labels_and_settings.items(): |
104 | @@ -783,8 +836,10 @@ | |||
105 | 783 | break | 836 | break |
106 | 784 | 837 | ||
107 | 785 | for name in self.gb_doubleclick_checkbutton_names: | 838 | for name in self.gb_doubleclick_checkbutton_names: |
110 | 786 | self.gb_doubleclick_checkbutton[name].set_active( | 839 | self.gb_doubleclick_checkbutton[name].set_active(self.globals.settings[name]) |
111 | 787 | self.globals.settings[name]) | 840 | |
112 | 841 | for name in self.gb_close_popup_on_click_checkbutton_names: | ||
113 | 842 | self.gb_close_popup_on_click_checkbutton[name].set_active(self.globals.settings[name]) | ||
114 | 788 | 843 | ||
115 | 789 | # Opacify | 844 | # Opacify |
116 | 790 | self.opacify_cb.set_active(self.globals.settings['opacify']) | 845 | self.opacify_cb.set_active(self.globals.settings['opacify']) |
117 | 791 | 846 | ||
118 | === modified file 'dockbarx/__init__.py' (properties changed: -x to +x) | |||
119 | === modified file 'dockbarx/cairowidgets.py' (properties changed: -x to +x) | |||
120 | --- dockbarx/cairowidgets.py 2010-05-25 15:06:34 +0000 | |||
121 | +++ dockbarx/cairowidgets.py 2010-07-05 16:50:40 +0000 | |||
122 | @@ -209,4 +209,3 @@ | |||
123 | 209 | ctx.set_source_rgba(0.0, 0.0, 0.0, alpha) | 209 | ctx.set_source_rgba(0.0, 0.0, 0.0, alpha) |
124 | 210 | ctx.set_line_width(1) | 210 | ctx.set_line_width(1) |
125 | 211 | ctx.stroke() | 211 | ctx.stroke() |
126 | 212 | |||
127 | 213 | 212 | ||
128 | === modified file 'dockbarx/common.py' (properties changed: -x to +x) | |||
129 | --- dockbarx/common.py 2010-06-29 16:11:43 +0000 | |||
130 | +++ dockbarx/common.py 2010-07-05 16:50:40 +0000 | |||
131 | @@ -140,6 +140,7 @@ | |||
132 | 140 | return False | 140 | return False |
133 | 141 | 141 | ||
134 | 142 | 142 | ||
135 | 143 | |||
136 | 143 | class Globals(gobject.GObject): | 144 | class Globals(gobject.GObject): |
137 | 144 | """ Globals is a signletron containing all the "global" variables of dockbarx. | 145 | """ Globals is a signletron containing all the "global" variables of dockbarx. |
138 | 145 | 146 | ||
139 | @@ -156,38 +157,37 @@ | |||
140 | 156 | 'gkey-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,()) | 157 | 'gkey-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,()) |
141 | 157 | } | 158 | } |
142 | 158 | 159 | ||
145 | 159 | DEFAULT_SETTINGS = { | 160 | DEFAULT_SETTINGS = { "theme": "default", |
144 | 160 | "theme": "default", | ||
146 | 161 | "groupbutton_attention_notification_type": "red", | 161 | "groupbutton_attention_notification_type": "red", |
147 | 162 | "workspace_behavior": "switch", | 162 | "workspace_behavior": "switch", |
148 | 163 | "popup_delay": 250, | 163 | "popup_delay": 250, |
149 | 164 | "popup_delay_second": 30, | ||
150 | 165 | "close_popup_on_click": False, | ||
151 | 166 | "disable_popup_on_groupbutton_click":False, | ||
152 | 167 | "close_popup_on_groupbutton_click":False, | ||
153 | 164 | "popup_align": "center", | 168 | "popup_align": "center", |
154 | 165 | "no_popup_for_one_window": False, | 169 | "no_popup_for_one_window": False, |
155 | 166 | "show_only_current_desktop": False, | 170 | "show_only_current_desktop": False, |
156 | 167 | "preview": False, | 171 | "preview": False, |
157 | 172 | "remember_previews": False, | ||
158 | 168 | "preview_size": 230, | 173 | "preview_size": 230, |
160 | 169 | 174 | ||
161 | 170 | "select_one_window": "select or minimize window", | 175 | "select_one_window": "select or minimize window", |
162 | 171 | "select_multiple_windows": "select all", | 176 | "select_multiple_windows": "select all", |
164 | 172 | 177 | ||
165 | 173 | "opacify": False, | 178 | "opacify": False, |
166 | 174 | "opacify_group": False, | 179 | "opacify_group": False, |
167 | 175 | "opacify_alpha": 11, | 180 | "opacify_alpha": 11, |
169 | 176 | 181 | ||
170 | 177 | "separate_wine_apps": True, | 182 | "separate_wine_apps": True, |
171 | 178 | "separate_ooo_apps": True, | 183 | "separate_ooo_apps": True, |
181 | 179 | 184 | ||
182 | 180 | "groupbutton_left_click_action": \ | 185 | "groupbutton_left_click_action":"select or minimize group", |
183 | 181 | "select or minimize group", | 186 | "groupbutton_shift_and_left_click_action":"launch application", |
184 | 182 | "groupbutton_shift_and_left_click_action": \ | 187 | "groupbutton_middle_click_action":"close all windows", |
185 | 183 | "launch application", | 188 | "groupbutton_shift_and_middle_click_action": "no action", |
177 | 184 | "groupbutton_middle_click_action": \ | ||
178 | 185 | "close all windows", | ||
179 | 186 | "groupbutton_shift_and_middle_click_action": \ | ||
180 | 187 | "no action", | ||
186 | 188 | "groupbutton_right_click_action": "show menu", | 189 | "groupbutton_right_click_action": "show menu", |
189 | 189 | "groupbutton_shift_and_right_click_action": \ | 190 | "groupbutton_shift_and_right_click_action": "no action", |
188 | 190 | "no action", | ||
190 | 191 | "groupbutton_scroll_up": "select next window", | 191 | "groupbutton_scroll_up": "select next window", |
191 | 192 | "groupbutton_scroll_down": "select previous window", | 192 | "groupbutton_scroll_down": "select previous window", |
192 | 193 | "groupbutton_left_click_double": False, | 193 | "groupbutton_left_click_double": False, |
193 | @@ -196,19 +196,22 @@ | |||
194 | 196 | "groupbutton_shift_and_middle_click_double": False, | 196 | "groupbutton_shift_and_middle_click_double": False, |
195 | 197 | "groupbutton_right_click_double": False, | 197 | "groupbutton_right_click_double": False, |
196 | 198 | "groupbutton_shift_and_right_click_double": False, | 198 | "groupbutton_shift_and_right_click_double": False, |
205 | 199 | "windowbutton_left_click_action": \ | 199 | "windowbutton_left_click_action":"select or minimize window", |
206 | 200 | "select or minimize window", | 200 | "windowbutton_shift_and_left_click_action":"no action", |
207 | 201 | "windowbutton_shift_and_left_click_action": \ | 201 | "windowbutton_middle_click_action":"close window", |
208 | 202 | "no action", | 202 | "windowbutton_shift_and_middle_click_action": "no action", |
201 | 203 | "windowbutton_middle_click_action": \ | ||
202 | 204 | "close window", | ||
203 | 205 | "windowbutton_shift_and_middle_click_action": \ | ||
204 | 206 | "no action", | ||
209 | 207 | "windowbutton_right_click_action": "show menu", | 203 | "windowbutton_right_click_action": "show menu", |
212 | 208 | "windowbutton_shift_and_right_click_action": \ | 204 | "windowbutton_shift_and_right_click_action": "no action", |
211 | 209 | "no action", | ||
213 | 210 | "windowbutton_scroll_up": "shade window", | 205 | "windowbutton_scroll_up": "shade window", |
214 | 211 | "windowbutton_scroll_down": "unshade window", | 206 | "windowbutton_scroll_down": "unshade window", |
215 | 207 | "windowbutton_close_popup_on_left_click": False, | ||
216 | 208 | "windowbutton_close_popup_on_shift_and_left_click": False, | ||
217 | 209 | "windowbutton_close_popup_on_middle_click": False, | ||
218 | 210 | "windowbutton_close_popup_on_shift_and_middle_click": False, | ||
219 | 211 | "windowbutton_close_popup_on_right_click": False, | ||
220 | 212 | "windowbutton_close_popup_on_shift_and_right_click": False, | ||
221 | 213 | "windowbutton_close_popup_on_scroll_up": False, | ||
222 | 214 | "windowbutton_close_popup_on_scroll_down": False, | ||
223 | 212 | 215 | ||
224 | 213 | "gkeys_select_next_group": False, | 216 | "gkeys_select_next_group": False, |
225 | 214 | "gkeys_select_next_group_keystr": '<super>Tab', | 217 | "gkeys_select_next_group_keystr": '<super>Tab', |
226 | @@ -257,6 +260,8 @@ | |||
227 | 257 | self.orient = 'h' | 260 | self.orient = 'h' |
228 | 258 | self.apps_by_id = {} | 261 | self.apps_by_id = {} |
229 | 259 | self.theme_name = None | 262 | self.theme_name = None |
230 | 263 | # link to current popup being shown | ||
231 | 264 | self.popup_showing = None | ||
232 | 260 | 265 | ||
233 | 261 | # Get gconf settings | 266 | # Get gconf settings |
234 | 262 | self.settings = self.DEFAULT_SETTINGS.copy() | 267 | self.settings = self.DEFAULT_SETTINGS.copy() |
235 | 263 | 268 | ||
236 | === modified file 'dockbarx/dockbar.py' (properties changed: -x to +x) | |||
237 | --- dockbarx/dockbar.py 2010-07-03 14:15:35 +0000 | |||
238 | +++ dockbarx/dockbar.py 2010-07-05 16:50:40 +0000 | |||
239 | @@ -257,7 +257,7 @@ | |||
240 | 257 | self.windows = None | 257 | self.windows = None |
241 | 258 | self.container = None | 258 | self.container = None |
242 | 259 | self.theme = None | 259 | self.theme = None |
244 | 260 | 260 | self.popup_showing = None | |
245 | 261 | self.gkeys = { | 261 | self.gkeys = { |
246 | 262 | 'gkeys_select_next_group': None, | 262 | 'gkeys_select_next_group': None, |
247 | 263 | 'gkeys_select_previous_group': None, | 263 | 'gkeys_select_previous_group': None, |
248 | @@ -453,9 +453,8 @@ | |||
249 | 453 | 453 | ||
250 | 454 | 454 | ||
251 | 455 | def reset_all_surfaces(self): | 455 | def reset_all_surfaces(self): |
255 | 456 | # Removes all saved pixbufs with active glow in groupbuttons | 456 | # Removes all saved pixbufs with active glow in groupbuttons iconfactories. |
256 | 457 | # iconfactories. Use this def when the looks of active glow | 457 | # Use this def when the looks of active glow has been changed. |
254 | 458 | # has been changed. | ||
257 | 459 | for group in self.groups.get_groups(): | 458 | for group in self.groups.get_groups(): |
258 | 460 | group.icon_factory.reset_surfaces() | 459 | group.icon_factory.reset_surfaces() |
259 | 461 | 460 | ||
260 | @@ -475,6 +474,9 @@ | |||
261 | 475 | 474 | ||
262 | 476 | #### Applet events | 475 | #### Applet events |
263 | 477 | def on_ppm_pref(self,event=None,data=None): | 476 | def on_ppm_pref(self,event=None,data=None): |
264 | 477 | # close any popup list before | ||
265 | 478 | if self.popup_showing is not None: | ||
266 | 479 | self.popup_showing.hide_list() | ||
267 | 478 | # Starts the preference dialog | 480 | # Starts the preference dialog |
268 | 479 | os.spawnlp(os.P_NOWAIT,'/usr/bin/dbx_preference.py', | 481 | os.spawnlp(os.P_NOWAIT,'/usr/bin/dbx_preference.py', |
269 | 480 | '/usr/bin/dbx_preference.py') | 482 | '/usr/bin/dbx_preference.py') |
270 | @@ -1013,8 +1015,7 @@ | |||
271 | 1013 | entry = combobox.get_child() | 1015 | entry = combobox.get_child() |
272 | 1014 | if identifier: | 1016 | if identifier: |
273 | 1015 | entry.set_text(identifier) | 1017 | entry.set_text(identifier) |
276 | 1016 | # Fill the popdown list with the names of all class | 1018 | # Fill the popdown list with the names of all class names of buttons that hasn't got a launcher already |
275 | 1017 | # names of buttons that hasn't got a launcher already | ||
277 | 1018 | for name in self.groups.get_non_launcher_names(): | 1019 | for name in self.groups.get_non_launcher_names(): |
278 | 1019 | combobox.append_text(name) | 1020 | combobox.append_text(name) |
279 | 1020 | entry = combobox.get_child() | 1021 | entry = combobox.get_child() |
280 | @@ -1211,4 +1212,4 @@ | |||
281 | 1211 | gr.action_select_next_with_popup(previous=previous) | 1212 | gr.action_select_next_with_popup(previous=previous) |
282 | 1212 | 1213 | ||
283 | 1213 | def gkey_select_previous_window_in_group(self): | 1214 | def gkey_select_previous_window_in_group(self): |
284 | 1214 | self.gkey_select_next_window_in_group(previous=True) | ||
285 | 1215 | \ No newline at end of file | 1215 | \ No newline at end of file |
286 | 1216 | self.gkey_select_next_window_in_group(previous=True) | ||
287 | 1216 | 1217 | ||
288 | === modified file 'dockbarx/groupbutton.py' (properties changed: -x to +x) | |||
289 | --- dockbarx/groupbutton.py 2010-06-22 11:05:20 +0000 | |||
290 | +++ dockbarx/groupbutton.py 2010-07-05 16:50:40 +0000 | |||
291 | @@ -112,12 +112,14 @@ | |||
292 | 112 | uri = uri.replace("%20","\ ") | 112 | uri = uri.replace("%20","\ ") |
293 | 113 | uri = unquote(uri) | 113 | uri = unquote(uri) |
294 | 114 | self.execute("%s %s"%(self.desktop_entry.getExec(), uri)) | 114 | self.execute("%s %s"%(self.desktop_entry.getExec(), uri)) |
296 | 115 | 115 | exe = exe[:exe.rfind('.')] | |
297 | 116 | return exe | ||
298 | 116 | 117 | ||
299 | 117 | def launch(self): | 118 | def launch(self): |
300 | 118 | os.chdir(os.path.expanduser('~')) | 119 | os.chdir(os.path.expanduser('~')) |
301 | 119 | if self.app: | 120 | if self.app: |
302 | 120 | print "Executing", self.app.get_name() | 121 | print "Executing", self.app.get_name() |
303 | 122 | |||
304 | 121 | return self.app.launch(None, None) | 123 | return self.app.launch(None, None) |
305 | 122 | else: | 124 | else: |
306 | 123 | print 'Executing %s'%self.desktop_entry.getExec() | 125 | print 'Executing %s'%self.desktop_entry.getExec() |
307 | @@ -187,7 +189,6 @@ | |||
308 | 187 | "Can't initiate Group button without identifier or launcher." | 189 | "Can't initiate Group button without identifier or launcher." |
309 | 188 | 190 | ||
310 | 189 | 191 | ||
311 | 190 | |||
312 | 191 | # Variables | 192 | # Variables |
313 | 192 | self.windows = {} | 193 | self.windows = {} |
314 | 193 | self.minimized_windows_count = 0 | 194 | self.minimized_windows_count = 0 |
315 | @@ -205,7 +206,7 @@ | |||
316 | 205 | # Compiz sends out false mouse enter messages after button is pressed. | 206 | # Compiz sends out false mouse enter messages after button is pressed. |
317 | 206 | # This works around that bug. | 207 | # This works around that bug. |
318 | 207 | self.button_pressed = False | 208 | self.button_pressed = False |
320 | 208 | 209 | self.button_pressed_left = False | |
321 | 209 | self.screen = wnck.screen_get_default() | 210 | self.screen = wnck.screen_get_default() |
322 | 210 | self.root_xid = int(gtk.gdk.screen_get_default().get_root_window().xid) | 211 | self.root_xid = int(gtk.gdk.screen_get_default().get_root_window().xid) |
323 | 211 | 212 | ||
324 | @@ -219,13 +220,11 @@ | |||
325 | 219 | 220 | ||
326 | 220 | 221 | ||
327 | 221 | # Button events | 222 | # Button events |
335 | 222 | self.button.connect("enter-notify-event", self.on_button_mouse_enter) | 223 | self.button.connect("enter-notify-event",self.on_button_mouse_enter) |
336 | 223 | self.button.connect("leave-notify-event", self.on_button_mouse_leave) | 224 | self.button.connect("leave-notify-event",self.on_button_mouse_leave) |
337 | 224 | self.button.connect("button-release-event", | 225 | self.button.connect("button-release-event",self.on_group_button_release_event) |
338 | 225 | self.on_group_button_release_event) | 226 | self.button.connect("button-press-event",self.on_group_button_press_event) |
339 | 226 | self.button.connect("button-press-event", | 227 | self.button.connect("scroll-event",self.on_group_button_scroll_event) |
333 | 227 | self.on_group_button_press_event) | ||
334 | 228 | self.button.connect("scroll-event", self.on_group_button_scroll_event) | ||
340 | 229 | self.button.connect("size-allocate", self.on_sizealloc) | 228 | self.button.connect("size-allocate", self.on_sizealloc) |
341 | 230 | self.button_old_alloc = self.button.get_allocation() | 229 | self.button_old_alloc = self.button.get_allocation() |
342 | 231 | 230 | ||
343 | @@ -251,6 +250,16 @@ | |||
344 | 251 | self.winlist = None | 250 | self.winlist = None |
345 | 252 | self.on_show_previews_changed() | 251 | self.on_show_previews_changed() |
346 | 253 | 252 | ||
347 | 253 | |||
348 | 254 | self.popup = cairo_popup.window | ||
349 | 255 | self.popup_showing = False | ||
350 | 256 | self.popup_showing_by_delay = False | ||
351 | 257 | self.popup_just_closed_by_group_button = False | ||
352 | 258 | self.popup_delay_request_id = None | ||
353 | 259 | self.disable_popup_delay = False | ||
354 | 260 | self.delay_hide_list_request_id = None | ||
355 | 261 | self.delay_hide_list_done = False | ||
356 | 262 | self.popup.connect("leave-notify-event",self.on_popup_mouse_leave) | ||
357 | 254 | self.popup.add(self.popup_box) | 263 | self.popup.add(self.popup_box) |
358 | 255 | 264 | ||
359 | 256 | 265 | ||
360 | @@ -322,7 +331,7 @@ | |||
361 | 322 | return False | 331 | return False |
362 | 323 | 332 | ||
363 | 324 | #### State | 333 | #### State |
365 | 325 | def update_popup_label(self, arg=None): | 334 | def update_popup_label(self): |
366 | 326 | self.popup_label.set_text( | 335 | self.popup_label.set_text( |
367 | 327 | "<span foreground='%s'>"%self.globals.colors['color2'] + \ | 336 | "<span foreground='%s'>"%self.globals.colors['color2'] + \ |
368 | 328 | "<big><b>%s</b></big></span>"%self.name | 337 | "<big><b>%s</b></big></span>"%self.name |
369 | @@ -369,15 +378,13 @@ | |||
370 | 369 | else: | 378 | else: |
371 | 370 | icon_effect = 0 | 379 | icon_effect = 0 |
372 | 371 | 380 | ||
378 | 372 | if self.mouse_over: | 381 | if self.button_pressed_left is True: |
379 | 373 | mouse_over = IconFactory.MOUSE_OVER | 382 | mouse_over = IconFactory.MOUSE_BUTTON_DOWN |
380 | 374 | elif self.button_drag_entered and not self.launcher_drag: | 383 | elif self.mouse_over: |
376 | 375 | # Mouse over effect on other drag and drop | ||
377 | 376 | # than launcher dnd. | ||
381 | 377 | mouse_over = IconFactory.MOUSE_OVER | 384 | mouse_over = IconFactory.MOUSE_OVER |
382 | 378 | else: | 385 | else: |
383 | 379 | mouse_over = 0 | 386 | mouse_over = 0 |
385 | 380 | 387 | ||
386 | 381 | if self.launch_effect: | 388 | if self.launch_effect: |
387 | 382 | launch_effect = IconFactory.LAUNCH_EFFECT | 389 | launch_effect = IconFactory.LAUNCH_EFFECT |
388 | 383 | else: | 390 | else: |
389 | @@ -702,19 +709,27 @@ | |||
390 | 702 | 709 | ||
391 | 703 | 710 | ||
392 | 704 | #### Show/hide list | 711 | #### Show/hide list |
394 | 705 | def show_list_request(self): | 712 | def show_list_request(self, request_by_popup_delay = False): |
395 | 713 | # ignore request if just closed popup | ||
396 | 714 | #if self.popup_just_closed_by_group_button is True: | ||
397 | 715 | if self.disable_popup_delay is True: | ||
398 | 716 | return False | ||
399 | 706 | # If mouse cursor is over the button, show popup window. | 717 | # If mouse cursor is over the button, show popup window. |
400 | 707 | b_m_x,b_m_y = self.button.get_pointer() | 718 | b_m_x,b_m_y = self.button.get_pointer() |
401 | 708 | b_r = self.button.get_allocation() | 719 | b_r = self.button.get_allocation() |
408 | 709 | if self.popup_showing \ | 720 | if self.popup_showing is False and ((b_m_x>=0 and b_m_x<b_r.width) and (b_m_y >= 0 and b_m_y < b_r.height) \ |
409 | 710 | or ((b_m_x>=0 and b_m_x<b_r.width) \ | 721 | and not self.globals.right_menu_showing and not self.globals.dragging): |
410 | 711 | and (b_m_y >= 0 and b_m_y < b_r.height) \ | 722 | self.show_list(request_by_popup_delay) |
405 | 712 | and not self.globals.right_menu_showing \ | ||
406 | 713 | and not self.globals.dragging): | ||
407 | 714 | self.show_list() | ||
411 | 715 | return False | 723 | return False |
412 | 716 | 724 | ||
414 | 717 | def show_list(self): | 725 | def show_list(self, request_by_popup_delay = False): |
415 | 726 | # set what kind of request we have | ||
416 | 727 | # tist must even if popup already showing so that it will be known what is last request | ||
417 | 728 | self.popup_showing_by_delay = request_by_popup_delay | ||
418 | 729 | # no need to do anything if alreay showing popup | ||
419 | 730 | if self.popup_showing is True: | ||
420 | 731 | return | ||
421 | 732 | |||
422 | 718 | # Move popup to it's right spot and show it. | 733 | # Move popup to it's right spot and show it. |
423 | 719 | offset = 3 | 734 | offset = 3 |
424 | 720 | 735 | ||
425 | @@ -780,10 +795,17 @@ | |||
426 | 780 | self.popup.move(x - w - offset,y) | 795 | self.popup.move(x - w - offset,y) |
427 | 781 | else: | 796 | else: |
428 | 782 | self.popup.move(x + b_alloc.width + offset,y) | 797 | self.popup.move(x + b_alloc.width + offset,y) |
429 | 798 | |||
430 | 783 | self.popup.show() | 799 | self.popup.show() |
431 | 784 | self.popup_showing = True | 800 | self.popup_showing = True |
434 | 785 | self.on_set_icongeo_win() | 801 | self.delay_hide_list_done = False |
435 | 786 | # The popup must be shown before the | 802 | |
436 | 803 | # close any others current popups | ||
437 | 804 | if self.globals.popup_showing is not None: | ||
438 | 805 | self.globals.popup_showing.hide_list() | ||
439 | 806 | # and define this one as current popup | ||
440 | 807 | self.globals.popup_showing = self | ||
441 | 808 | self.on_set_icongeo_win() | ||
442 | 787 | # preview can be set. Iterate gtk events. | 809 | # preview can be set. Iterate gtk events. |
443 | 788 | while gtk.events_pending(): | 810 | while gtk.events_pending(): |
444 | 789 | gtk.main_iteration(False) | 811 | gtk.main_iteration(False) |
445 | @@ -811,73 +833,151 @@ | |||
446 | 811 | previews) | 833 | previews) |
447 | 812 | return False | 834 | return False |
448 | 813 | 835 | ||
507 | 814 | def hide_list_request(self): | 836 | def delay_hide_list_request(self): |
508 | 815 | if self.popup.window == None: | 837 | # remove hide_list_request id if was called by timeout |
509 | 816 | return | 838 | self.delay_hide_list_request_id = None |
510 | 817 | # Checks if mouse cursor really isn't hovering the button | 839 | self.delay_hide_list_done = True |
511 | 818 | # or the popup window anymore and hide the popup window | 840 | |
512 | 819 | # if so. | 841 | |
513 | 820 | p_m_x,p_m_y = self.popup.get_pointer() | 842 | def hide_list_request(self): |
514 | 821 | p_w,p_h = self.popup.get_size() | 843 | |
515 | 822 | b_m_x,b_m_y = self.button.get_pointer() | 844 | # verify that popup window is present and is showing else dont have to do anything |
516 | 823 | b_r = self.button.get_allocation() | 845 | if self.popup.window == None or self.popup_showing is False: |
517 | 824 | r = 6 #radius for the rounded corner of popup window | 846 | return |
518 | 825 | 847 | ||
519 | 826 | # Make sure that the popup list isn't closed when | 848 | |
520 | 827 | # howering the gap between button and list. | 849 | # verify validity of request based on close_popup_on_click settings |
521 | 828 | w,h = self.popup.get_size() | 850 | if self.globals.settings['close_popup_on_click'] is not True: |
522 | 829 | p_x,p_y = self.popup.window.get_origin() | 851 | # Checks if mouse cursor really isn't hovering the button |
523 | 830 | offset = 3 | 852 | # or the popup window anymore and hide the popup window |
524 | 831 | b_x,b_y = self.button.window.get_origin() | 853 | # if so. |
525 | 832 | if self.globals.orient == 'h' \ | 854 | p_m_x,p_m_y = self.popup.get_pointer() |
526 | 833 | and b_m_x >= -8 and b_m_x <= (b_r.width+7): | 855 | p_w,p_h = self.popup.get_size() |
527 | 834 | if (p_y < b_y and b_m_y >= -offset and b_m_y <= 0) \ | 856 | b_m_x,b_m_y = self.button.get_pointer() |
528 | 835 | or (p_y > b_y and b_m_y >= (b_r.height - 1) \ | 857 | b_r = self.button.get_allocation() |
529 | 836 | and b_m_y <= (b_r.height - 1 + offset)): | 858 | r = 5 #radius for the rounded corner of popup window |
530 | 837 | gobject.timeout_add(50, self.hide_list_request) | 859 | |
531 | 838 | return | 860 | # Make sure that the popup list isn't closed when |
532 | 839 | elif self.globals.orient == 'v' \ | 861 | # howering the gap between button and list. |
533 | 840 | and b_m_y >= -8 and b_m_y <= (b_r.height+7): | 862 | w,h = self.popup.get_size() |
534 | 841 | if (p_x < b_x and b_m_x >= -offset and b_m_x <= 0) \ | 863 | p_x,p_y = self.popup.window.get_origin() |
535 | 842 | or (p_x > b_x and b_m_x >= (b_r.width - 1) \ | 864 | offset = 3 |
536 | 843 | and b_m_x <= (b_r.width - 1 + offset)): | 865 | b_x,b_y = self.button.window.get_origin() |
537 | 844 | gobject.timeout_add(50, self.hide_list_request) | 866 | if self.globals.orient == 'h' and b_m_x>=0 and b_m_x<=(b_r.width-1): |
538 | 845 | return | 867 | if (p_y < b_y and b_m_y>=-offset and b_m_y<=0) \ |
539 | 846 | 868 | or (p_y > b_y and b_m_y>=(b_r.height-1) and b_m_y<=(b_r.height-1+offset)): | |
540 | 847 | if p_m_x >= 0 and p_m_x < p_w \ | 869 | gobject.timeout_add(50, self.hide_list_request) # org value was 50 |
541 | 848 | and p_m_y >= 0 and p_m_y < p_h: | 870 | return |
542 | 849 | # Mouse pointer is inside the "rectangle" | 871 | elif self.globals.orient == 'v' and b_m_y>=0 and b_m_y<=(b_r.height-1): |
543 | 850 | # but check if it's still outside the rounded corners | 872 | if (p_x < b_x and b_m_x>=-offset and b_m_x<=0) \ |
544 | 851 | x = None | 873 | or (p_x > b_x and b_m_x>=(b_r.width-1) and b_m_x<=(b_r.width-1+offset)): |
545 | 852 | y = None | 874 | gobject.timeout_add(50, self.hide_list_request) # org value was 50 |
546 | 853 | if p_m_x < r: | 875 | return |
547 | 854 | x = r - p_m_x | 876 | |
548 | 855 | if (p_w - p_m_x) < r: | 877 | if not ((p_m_x<0 or p_m_x>(p_w-1))or(p_m_y<0 or p_m_y>(p_h-1))): |
549 | 856 | x = p_m_x - (p_w - r) | 878 | # Mouse pointer is inside the "rectangle" |
550 | 857 | if p_m_y < r: | 879 | # but check if it's still outside the rounded corners |
551 | 858 | y = r - p_m_y | 880 | x = None |
552 | 859 | if (p_h - p_m_y) < r: | 881 | y = None |
553 | 860 | y = p_m_y - (p_h - r) | 882 | if p_m_x < r: |
554 | 861 | if x == None or y == None \ | 883 | x = r - p_m_x |
555 | 862 | or (x**2 + y**2) < (r-1)**2: | 884 | if (p_w - p_m_x) < r: |
556 | 863 | # It's inside the rounded corners! | 885 | x = p_m_x - (p_w - r) |
557 | 864 | return | 886 | if p_m_y < r: |
558 | 865 | if b_m_x >= 0 and b_m_x < b_r.width \ | 887 | y = r - p_m_y |
559 | 866 | and b_m_y >= 0 and b_m_y < b_r.height: | 888 | if (p_h - p_m_y) < r: |
560 | 867 | # Mouse pointer is over the group button. | 889 | y = p_m_y - (p_h - r) |
561 | 868 | gobject.timeout_add(50, self.hide_list_request) | 890 | if x == None or y == None \ |
562 | 869 | # This timeout add is needed if mouse cursor leaves the | 891 | or (x**2 + y**2) < (r-1)**2: |
563 | 870 | # screen following the screen edge. | 892 | # It's inside the rounded corners! |
564 | 871 | return | 893 | return |
565 | 894 | if not ((b_m_x<0 or b_m_x>(b_r.width-1)) or (b_m_y<0 or b_m_y>(b_r.height-1))): | ||
566 | 895 | # Mouse pointer is over the group button. | ||
567 | 896 | gobject.timeout_add(50, self.hide_list_request) # org value was 50 | ||
568 | 897 | # This timeout add is needed if mouse cursor leaves the | ||
569 | 898 | # screen following the screen edge. | ||
570 | 899 | return | ||
571 | 900 | else: | ||
572 | 901 | # if closing popup on mouse click | ||
573 | 902 | # then get all global click (desktop global) by getting pointer position and mask | ||
574 | 903 | display = gtk.gdk.display_get_default() | ||
575 | 904 | pos = display.get_pointer() | ||
576 | 905 | # if button modifiers are clicked then check if should realy close popup | ||
577 | 906 | if pos[3] == gtk.gdk.BUTTON1_MASK or pos[3] == gtk.gdk.BUTTON2_MASK \ | ||
578 | 907 | or pos[3] == gtk.gdk.BUTTON3_MASK or pos[3] == gtk.gdk.BUTTON4_MASK \ | ||
579 | 908 | or pos[3] == gtk.gdk.BUTTON5_MASK or (self.popup_showing_by_delay is True and self.delay_hide_list_done is True): | ||
580 | 909 | # close popup only if mouse position is not on list or on group button | ||
581 | 910 | p_m_x,p_m_y = self.popup.get_pointer() | ||
582 | 911 | p_w,p_h = self.popup.get_size() | ||
583 | 912 | b_m_x,b_m_y = self.button.get_pointer() | ||
584 | 913 | b_r = self.button.get_allocation() | ||
585 | 914 | r = 5 #radius for the rounded corner of popup window | ||
586 | 915 | |||
587 | 916 | # Make sure that the popup list isn't closed when | ||
588 | 917 | # howering the gap between button and list. | ||
589 | 918 | w,h = self.popup.get_size() | ||
590 | 919 | p_x,p_y = self.popup.window.get_origin() | ||
591 | 920 | offset = 3 | ||
592 | 921 | b_x,b_y = self.button.window.get_origin() | ||
593 | 922 | if self.globals.orient == 'h' and b_m_x>=0 and b_m_x<=(b_r.width-1): | ||
594 | 923 | if (p_y < b_y and b_m_y>=-offset and b_m_y<=0) \ | ||
595 | 924 | or (p_y > b_y and b_m_y>=(b_r.height-1) and b_m_y<=(b_r.height-1+offset)): | ||
596 | 925 | ##gobject.timeout_add(10, self.hide_list_request) | ||
597 | 926 | #print "waiting for new on click ..." | ||
598 | 927 | return | ||
599 | 928 | elif self.globals.orient == 'v' and b_m_y>=0 and b_m_y<=(b_r.height-1): | ||
600 | 929 | if (p_x < b_x and b_m_x>=-offset and b_m_x<=0) \ | ||
601 | 930 | or (p_x > b_x and b_m_x>=(b_r.width-1) and b_m_x<=(b_r.width-1+offset)): | ||
602 | 931 | ##gobject.timeout_add(10, self.hide_list_request) | ||
603 | 932 | #print "waiting for new on click ..." | ||
604 | 933 | return | ||
605 | 934 | |||
606 | 935 | if not ((p_m_x<0 or p_m_x>(p_w-1))or(p_m_y<0 or p_m_y>(p_h-1))): | ||
607 | 936 | # Mouse pointer is inside the "rectangle" | ||
608 | 937 | # but check if it's still outside the rounded corners | ||
609 | 938 | x = None | ||
610 | 939 | y = None | ||
611 | 940 | if p_m_x < r: | ||
612 | 941 | x = r - p_m_x | ||
613 | 942 | if (p_w - p_m_x) < r: | ||
614 | 943 | x = p_m_x - (p_w - r) | ||
615 | 944 | if p_m_y < r: | ||
616 | 945 | y = r - p_m_y | ||
617 | 946 | if (p_h - p_m_y) < r: | ||
618 | 947 | y = p_m_y - (p_h - r) | ||
619 | 948 | if x == None or y == None \ | ||
620 | 949 | or (x**2 + y**2) < (r-1)**2: | ||
621 | 950 | # It's inside the rounded corners! | ||
622 | 951 | return | ||
623 | 952 | if not ((b_m_x<0 or b_m_x>(b_r.width-1)) or (b_m_y<0 or b_m_y>(b_r.height-1))): | ||
624 | 953 | # click inside of group button - just ignore this request | ||
625 | 954 | # new request will be made when mouse leaves group button so | ||
626 | 955 | # there is no need to call timout | ||
627 | 956 | ##gobject.timeout_add(10, self.hide_list_request) | ||
628 | 957 | return | ||
629 | 958 | else: | ||
630 | 959 | # no click yet - continute waiting | ||
631 | 960 | gobject.timeout_add(10, self.hide_list_request) | ||
632 | 961 | #print "waiting for click ", self.global_click_id, " ..." | ||
633 | 962 | return | ||
634 | 963 | |||
635 | 872 | self.hide_list() | 964 | self.hide_list() |
636 | 873 | return | 965 | return |
637 | 874 | 966 | ||
638 | 875 | def hide_list(self): | 967 | def hide_list(self): |
639 | 968 | print "request to close popup" | ||
640 | 876 | self.popup.hide() | 969 | self.popup.hide() |
641 | 877 | self.popup_showing = False | 970 | self.popup_showing = False |
642 | 971 | self.popup_showing_by_delay = False | ||
643 | 972 | self.globals.popup_showing = None | ||
644 | 973 | self.delay_hide_list_done = False | ||
645 | 974 | |||
646 | 975 | if self.mouse_over is True: | ||
647 | 976 | self.disable_popup_delay = True | ||
648 | 977 | |||
649 | 878 | self.on_set_icongeo_grp() | 978 | self.on_set_icongeo_grp() |
650 | 879 | if self.globals.settings["preview"]: | 979 | if self.globals.settings["preview"]: |
652 | 880 | # Remove preview icon to save memory | 980 | # Remove previews to save memory. |
653 | 881 | for win in self.get_windows(): | 981 | for win in self.get_windows(): |
654 | 882 | self.windows[win].clear_preview_image() | 982 | self.windows[win].clear_preview_image() |
655 | 883 | gc.collect() | 983 | gc.collect() |
656 | @@ -950,16 +1050,12 @@ | |||
657 | 950 | if self.globals.opacity_values == None: | 1050 | if self.globals.opacity_values == None: |
658 | 951 | return False | 1051 | return False |
659 | 952 | try: | 1052 | try: |
664 | 953 | compiz_call('obs/screen0/opacity_values','set', | 1053 | compiz_call('obs/screen0/opacity_values','set', self.globals.opacity_values) |
665 | 954 | self.globals.opacity_values) | 1054 | compiz_call('obs/screen0/opacity_matches','set', self.globals.opacity_matches) |
662 | 955 | compiz_call('obs/screen0/opacity_matches','set', | ||
663 | 956 | self.globals.opacity_matches) | ||
666 | 957 | except: | 1055 | except: |
667 | 958 | try: | 1056 | try: |
672 | 959 | compiz_call('core/screen0/opacity_values','set', | 1057 | compiz_call('core/screen0/opacity_values','set', self.globals.opacity_values) |
673 | 960 | self.globals.opacity_values) | 1058 | compiz_call('core/screen0/opacity_matches','set', self.globals.opacity_matches) |
670 | 961 | compiz_call('core/screen0/opacity_matches','set', | ||
671 | 962 | self.globals.opacity_matches) | ||
674 | 963 | except: | 1059 | except: |
675 | 964 | print "Error: Couldn't set opacity back to normal." | 1060 | print "Error: Couldn't set opacity back to normal." |
676 | 965 | self.globals.opacity_values = None | 1061 | self.globals.opacity_values = None |
677 | @@ -1131,8 +1227,7 @@ | |||
678 | 1131 | self.on_set_icongeo_grp() | 1227 | self.on_set_icongeo_grp() |
679 | 1132 | 1228 | ||
680 | 1133 | def on_button_mouse_enter (self, widget, event): | 1229 | def on_button_mouse_enter (self, widget, event): |
683 | 1134 | # In compiz there is a enter and a leave event | 1230 | # In compiz there is a enter and a leave event before a button_press event. |
682 | 1135 | # before a button_press event. | ||
684 | 1136 | if self.button_pressed : | 1231 | if self.button_pressed : |
685 | 1137 | return | 1232 | return |
686 | 1138 | self.mouse_over = True | 1233 | self.mouse_over = True |
687 | @@ -1152,69 +1247,123 @@ | |||
688 | 1152 | if self.globals.settings["popup_delay"]>0: | 1247 | if self.globals.settings["popup_delay"]>0: |
689 | 1153 | self.on_set_icongeo_delay() | 1248 | self.on_set_icongeo_delay() |
690 | 1154 | if not self.globals.right_menu_showing and not self.globals.dragging: | 1249 | if not self.globals.right_menu_showing and not self.globals.dragging: |
693 | 1155 | gobject.timeout_add(self.globals.settings['popup_delay'], | 1250 | # if already showing some other popup then make request only if showing by group button delay |
694 | 1156 | self.show_list_request) | 1251 | if self.globals.popup_showing is not None and self.globals.popup_showing.popup_showing_by_delay is True: |
695 | 1252 | #make request with lower delay | ||
696 | 1253 | gobject.timeout_add(self.globals.settings['popup_delay_second'], self.show_list_request, True) | ||
697 | 1254 | elif self.globals.popup_showing is None: | ||
698 | 1255 | gobject.timeout_add(self.globals.settings['popup_delay'], self.show_list_request, True) | ||
699 | 1157 | 1256 | ||
700 | 1158 | def on_button_mouse_leave (self, widget, event): | 1257 | def on_button_mouse_leave (self, widget, event): |
703 | 1159 | # In compiz there is a enter and | 1258 | # In compiz there is a enter and a leave event before a button_press event. |
702 | 1160 | # a leave event before a button_press event. | ||
704 | 1161 | self.button_pressed = False | 1259 | self.button_pressed = False |
705 | 1162 | self.mouse_over = False | 1260 | self.mouse_over = False |
706 | 1261 | self.disable_popup_delay = False | ||
707 | 1262 | |||
708 | 1163 | self.update_state() | 1263 | self.update_state() |
710 | 1164 | self.hide_list_request() | 1264 | if self.popup_showing is True: |
711 | 1265 | # also remove and previous hide_list_request's so that timout will be correct | ||
712 | 1266 | if self.delay_hide_list_request_id is not None: | ||
713 | 1267 | gobject.source_remove(self.delay_hide_list_request_id) | ||
714 | 1268 | |||
715 | 1269 | # clear delay hide_list request flag | ||
716 | 1270 | self.delay_hide_list_done = False | ||
717 | 1271 | |||
718 | 1272 | # request for popup list to hide | ||
719 | 1273 | # if closing popup on click then should delay request | ||
720 | 1274 | if self.popup_showing_by_delay is True and self.globals.settings['close_popup_on_click']: | ||
721 | 1275 | |||
722 | 1276 | # make request | ||
723 | 1277 | request_timeout = 600 | ||
724 | 1278 | self.delay_hide_list_request_id = gobject.timeout_add(request_timeout,self.delay_hide_list_request) | ||
725 | 1279 | |||
726 | 1280 | self.hide_list_request() | ||
727 | 1281 | |||
728 | 1282 | elif self.popup_delay_request_id is not None: | ||
729 | 1283 | gobject.source_remove(self.popup_delay_request_id) | ||
730 | 1284 | self.popup_delay_request_id = None | ||
731 | 1165 | if self.popup.window == None: | 1285 | if self.popup.window == None: |
732 | 1166 | # self.hide_list takes care of 'set-icongeo-grp' normally | 1286 | # self.hide_list takes care of 'set-icongeo-grp' normally |
733 | 1167 | # but if no popup window exist its taken care of here. | 1287 | # but if no popup window exist its taken care of here. |
734 | 1168 | self.on_set_icongeo_grp() | 1288 | self.on_set_icongeo_grp() |
737 | 1169 | if self.globals.settings["opacify"] \ | 1289 | if self.globals.settings["opacify"] and self.globals.settings["opacify_group"]: |
736 | 1170 | and self.globals.settings["opacify_group"]: | ||
738 | 1171 | self.deopacify_request() | 1290 | self.deopacify_request() |
739 | 1172 | 1291 | ||
740 | 1173 | def on_popup_mouse_leave (self,widget,event): | 1292 | def on_popup_mouse_leave (self,widget,event): |
741 | 1293 | # request for popup list to hide | ||
742 | 1294 | |||
743 | 1295 | # remove any previous hide_list_request's o that timout will be correct | ||
744 | 1296 | if self.delay_hide_list_request_id is not None: | ||
745 | 1297 | gobject.source_remove(self.delay_hide_list_request_id) | ||
746 | 1298 | |||
747 | 1299 | # clear delay hide_list request flag | ||
748 | 1300 | self.delay_hide_list_done = False | ||
749 | 1301 | |||
750 | 1302 | # if closing popup on click then should delay request | ||
751 | 1303 | if self.popup_showing_by_delay is True and self.globals.settings['close_popup_on_click']: | ||
752 | 1304 | # make request | ||
753 | 1305 | request_timeout = 600 | ||
754 | 1306 | self.delay_hide_list_request_id = gobject.timeout_add(request_timeout,self.delay_hide_list_request) | ||
755 | 1307 | |||
756 | 1174 | self.hide_list_request() | 1308 | self.hide_list_request() |
757 | 1309 | return | ||
758 | 1175 | 1310 | ||
759 | 1176 | def on_group_button_scroll_event (self,widget,event): | 1311 | def on_group_button_scroll_event (self,widget,event): |
760 | 1312 | disable_popup = True | ||
761 | 1177 | if event.direction == gtk.gdk.SCROLL_UP: | 1313 | if event.direction == gtk.gdk.SCROLL_UP: |
762 | 1178 | action = self.globals.settings['groupbutton_scroll_up'] | 1314 | action = self.globals.settings['groupbutton_scroll_up'] |
763 | 1179 | self.action_function_dict[action](self, widget, event) | 1315 | self.action_function_dict[action](self, widget, event) |
764 | 1180 | elif event.direction == gtk.gdk.SCROLL_DOWN: | 1316 | elif event.direction == gtk.gdk.SCROLL_DOWN: |
765 | 1181 | action = self.globals.settings['groupbutton_scroll_down'] | 1317 | action = self.globals.settings['groupbutton_scroll_down'] |
766 | 1182 | self.action_function_dict[action](self, widget, event) | 1318 | self.action_function_dict[action](self, widget, event) |
767 | 1319 | else: | ||
768 | 1320 | disable_popup = False | ||
769 | 1321 | |||
770 | 1322 | # disbale popup list to be shown by delay when mouse clicked and action executed | ||
771 | 1323 | if self.globals.settings['disable_popup_on_groupbutton_click'] is True: | ||
772 | 1324 | self.disable_popup_delay = disable_popup; | ||
773 | 1183 | 1325 | ||
774 | 1184 | def on_group_button_release_event(self, widget, event): | 1326 | def on_group_button_release_event(self, widget, event): |
775 | 1327 | disable_popup = True | ||
776 | 1328 | self.button_pressed = False | ||
777 | 1329 | self.button_pressed_left = False | ||
778 | 1330 | self.update_state() | ||
779 | 1331 | |||
780 | 1185 | # Check that the mouse still is over the group button. | 1332 | # Check that the mouse still is over the group button. |
781 | 1186 | b_m_x,b_m_y = self.button.get_pointer() | 1333 | b_m_x,b_m_y = self.button.get_pointer() |
782 | 1187 | b_r = self.button.get_allocation() | 1334 | b_r = self.button.get_allocation() |
783 | 1188 | if b_m_x < 0 or b_m_x >= b_r.width or b_m_y < 0 or b_m_y >= b_r.height: | 1335 | if b_m_x < 0 or b_m_x >= b_r.width or b_m_y < 0 or b_m_y >= b_r.height: |
784 | 1189 | return | 1336 | return |
785 | 1190 | |||
786 | 1191 | # If a drag and drop just finnished set self.draggin to false | 1337 | # If a drag and drop just finnished set self.draggin to false |
787 | 1192 | # so that left clicking works normally again | 1338 | # so that left clicking works normally again |
788 | 1193 | if event.button == 1 and self.globals.dragging: | 1339 | if event.button == 1 and self.globals.dragging: |
789 | 1194 | self.globals.dragging = False | 1340 | self.globals.dragging = False |
790 | 1195 | return | 1341 | return |
791 | 1342 | |||
792 | 1196 | 1343 | ||
798 | 1197 | if not event.button in (1, 2, 3): | 1344 | if event.button in (1, 2, 3): |
799 | 1198 | return | 1345 | button = {1:'left', 2: 'middle', 3: 'right'}[event.button] |
800 | 1199 | button = {1:'left', 2: 'middle', 3: 'right'}[event.button] | 1346 | if event.state & gtk.gdk.SHIFT_MASK: |
801 | 1200 | if event.state & gtk.gdk.SHIFT_MASK: | 1347 | mod = 'shift_and_' |
802 | 1201 | mod = 'shift_and_' | 1348 | else: |
803 | 1349 | mod = '' | ||
804 | 1350 | if not self.globals.settings[ | ||
805 | 1351 | 'groupbutton_%s%s_click_double'%(mod, button)]: | ||
806 | 1352 | # No double click required, go ahead and do the action. | ||
807 | 1353 | action = self.globals.settings[ | ||
808 | 1354 | 'groupbutton_%s%s_click_action'%(mod, button)] | ||
809 | 1355 | self.action_function_dict[action](self, widget, event) | ||
810 | 1202 | else: | 1356 | else: |
818 | 1203 | mod = '' | 1357 | disable_popup = False |
812 | 1204 | if not self.globals.settings[ | ||
813 | 1205 | 'groupbutton_%s%s_click_double'%(mod, button)]: | ||
814 | 1206 | # No double click required, go ahead and do the action. | ||
815 | 1207 | action = self.globals.settings[ | ||
816 | 1208 | 'groupbutton_%s%s_click_action'%(mod, button)] | ||
817 | 1209 | self.action_function_dict[action](self, widget, event) | ||
819 | 1210 | 1358 | ||
820 | 1359 | # disbale popup list to be shown by delay when mouse clicked and action executed | ||
821 | 1360 | if self.globals.settings['disable_popup_on_groupbutton_click'] is True: | ||
822 | 1361 | self.disable_popup_delay = disable_popup; | ||
823 | 1211 | 1362 | ||
824 | 1212 | def on_group_button_press_event(self,widget,event): | 1363 | def on_group_button_press_event(self,widget,event): |
827 | 1213 | # In compiz there is a enter and a leave | 1364 | # In compiz there is a enter and a leave event before a button_press event. |
826 | 1214 | # event before a button_press event. | ||
828 | 1215 | # self.button_pressed is used to stop functions started with | 1365 | # self.button_pressed is used to stop functions started with |
831 | 1216 | # gobject.timeout_add from self.button_mouse_enter | 1366 | # gobject.timeout_add from self.button_mouse_enter or self.on_button_mouse_leave. |
830 | 1217 | # or self.on_button_mouse_leave. | ||
832 | 1218 | self.button_pressed = True | 1367 | self.button_pressed = True |
833 | 1219 | gobject.timeout_add(600, self.set_button_pressed_false) | 1368 | gobject.timeout_add(600, self.set_button_pressed_false) |
834 | 1220 | 1369 | ||
835 | @@ -1237,10 +1386,15 @@ | |||
836 | 1237 | elif event.button == 1: | 1386 | elif event.button == 1: |
837 | 1238 | # Return False so that a drag-and-drop can be initiated if needed. | 1387 | # Return False so that a drag-and-drop can be initiated if needed. |
838 | 1239 | return False | 1388 | return False |
839 | 1389 | |||
840 | 1390 | # disbale popup list to be shown by delay when mouse clicked and action executed | ||
841 | 1391 | if self.globals.settings['disable_popup_on_groupbutton_click'] is True: | ||
842 | 1392 | self.disable_popup_delay = True; | ||
843 | 1393 | |||
844 | 1240 | return True | 1394 | return True |
845 | 1241 | 1395 | ||
846 | 1242 | def set_button_pressed_false(self): | 1396 | def set_button_pressed_false(self): |
848 | 1243 | # Helper function to group_button_press_event. | 1397 | # Helper function to group_button_press_event |
849 | 1244 | self.button_pressed = False | 1398 | self.button_pressed = False |
850 | 1245 | return False | 1399 | return False |
851 | 1246 | 1400 | ||
852 | @@ -1286,6 +1440,7 @@ | |||
853 | 1286 | 1440 | ||
854 | 1287 | #### Actions | 1441 | #### Actions |
855 | 1288 | def action_select(self, widget, event): | 1442 | def action_select(self, widget, event): |
856 | 1443 | should_close_popup = self.globals.settings['close_popup_on_groupbutton_click'] | ||
857 | 1289 | wins = self.get_windows() | 1444 | wins = self.get_windows() |
858 | 1290 | if (self.launcher and not wins): | 1445 | if (self.launcher and not wins): |
859 | 1291 | self.action_launch_application() | 1446 | self.action_launch_application() |
860 | @@ -1293,29 +1448,24 @@ | |||
861 | 1293 | elif len(wins) == 1: | 1448 | elif len(wins) == 1: |
862 | 1294 | sow = self.globals.settings["select_one_window"] | 1449 | sow = self.globals.settings["select_one_window"] |
863 | 1295 | if sow == "select window": | 1450 | if sow == "select window": |
865 | 1296 | self.windows[wins[0]].action_select_window(widget, event) | 1451 | self.windows[wins[0]].action_select_window(widget, event, close_popup = should_close_popup) |
866 | 1297 | elif sow == "select or minimize window": | 1452 | elif sow == "select or minimize window": |
869 | 1298 | self.windows[wins[0]].action_select_or_minimize_window(widget, | 1453 | self.windows[wins[0]].action_select_or_minimize_window(widget, event, close_popup = should_close_popup) |
868 | 1299 | event) | ||
870 | 1300 | # Multiple windows | 1454 | # Multiple windows |
871 | 1301 | elif len(wins) > 1: | 1455 | elif len(wins) > 1: |
872 | 1302 | smw = self.globals.settings["select_multiple_windows"] | 1456 | smw = self.globals.settings["select_multiple_windows"] |
873 | 1303 | if smw == "select all": | 1457 | if smw == "select all": |
876 | 1304 | self.action_select_or_minimize_group(widget, event, | 1458 | self.action_select_or_minimize_group(widget, event, minimize=False) |
875 | 1305 | minimize=False) | ||
877 | 1306 | elif smw == "select or minimize all": | 1459 | elif smw == "select or minimize all": |
880 | 1307 | self.action_select_or_minimize_group(widget, event, | 1460 | self.action_select_or_minimize_group(widget, event, minimize=True) |
879 | 1308 | minimize=True) | ||
881 | 1309 | elif smw == "compiz scale": | 1461 | elif smw == "compiz scale": |
882 | 1310 | umw = self.get_unminimized_windows() | 1462 | umw = self.get_unminimized_windows() |
883 | 1311 | if len(umw) == 1: | 1463 | if len(umw) == 1: |
884 | 1312 | sow = self.globals.settings["select_one_window"] | 1464 | sow = self.globals.settings["select_one_window"] |
885 | 1313 | if sow == "select window": | 1465 | if sow == "select window": |
888 | 1314 | self.windows[umw[0]].action_select_window(widget, | 1466 | self.windows[umw[0]].action_select_window(widget, event, close_popup = should_close_popup) |
887 | 1315 | event) | ||
889 | 1316 | elif sow == "select or minimize window": | 1467 | elif sow == "select or minimize window": |
892 | 1317 | self.windows[umw[0]].action_select_or_minimize_window( | 1468 | self.windows[umw[0]].action_select_or_minimize_window(widget, event, close_popup = should_close_popup) |
891 | 1318 | widget, event) | ||
893 | 1319 | elif len(umw) == 0: | 1469 | elif len(umw) == 0: |
894 | 1320 | self.action_select_or_minimize_group(widget, event) | 1470 | self.action_select_or_minimize_group(widget, event) |
895 | 1321 | else: | 1471 | else: |
896 | @@ -1326,7 +1476,7 @@ | |||
897 | 1326 | self.action_select_popup(widget, event) | 1476 | self.action_select_popup(widget, event) |
898 | 1327 | 1477 | ||
899 | 1328 | def action_select_popup(self, widget, event): | 1478 | def action_select_popup(self, widget, event): |
901 | 1329 | if self.popup_showing is True: | 1479 | if self.popup_showing is True and self.popup_showing_by_delay is not True: |
902 | 1330 | self.hide_list() | 1480 | self.hide_list() |
903 | 1331 | else: | 1481 | else: |
904 | 1332 | self.show_list() | 1482 | self.show_list() |
905 | @@ -1348,6 +1498,9 @@ | |||
906 | 1348 | wingr = False | 1498 | wingr = False |
907 | 1349 | active_workspace = screen.get_active_workspace() | 1499 | active_workspace = screen.get_active_workspace() |
908 | 1350 | 1500 | ||
909 | 1501 | # close popup if at least one window gets activated | ||
910 | 1502 | close_popup = False | ||
911 | 1503 | |||
912 | 1351 | # Check if there are any uminimized windows, unminimize | 1504 | # Check if there are any uminimized windows, unminimize |
913 | 1352 | # them (unless they are on another workspace and work- | 1505 | # them (unless they are on another workspace and work- |
914 | 1353 | # space behavior is somehting other than move) and | 1506 | # space behavior is somehting other than move) and |
915 | @@ -1358,7 +1511,7 @@ | |||
916 | 1358 | if win.is_minimized(): | 1511 | if win.is_minimized(): |
917 | 1359 | ignored = False | 1512 | ignored = False |
918 | 1360 | if not win.is_pinned() and win.get_workspace() != None \ | 1513 | if not win.is_pinned() and win.get_workspace() != None \ |
920 | 1361 | and screen.get_active_workspace() != win.get_workspace(): | 1514 | and screen.get_active_workspace() != win.get_workspace(): |
921 | 1362 | if mode == 'move': | 1515 | if mode == 'move': |
922 | 1363 | ws = screen.get_active_workspace() | 1516 | ws = screen.get_active_workspace() |
923 | 1364 | win.move_to_workspace(ws) | 1517 | win.move_to_workspace(ws) |
924 | @@ -1375,7 +1528,11 @@ | |||
925 | 1375 | if not ignored: | 1528 | if not ignored: |
926 | 1376 | win.unminimize(event.time) | 1529 | win.unminimize(event.time) |
927 | 1377 | unminimized = True | 1530 | unminimized = True |
928 | 1531 | close_popup = True | ||
929 | 1378 | if unminimized: | 1532 | if unminimized: |
930 | 1533 | # before returing also close popup if at least one window got shown | ||
931 | 1534 | if close_popup is True and self.globals.settings['close_popup_on_groupbutton_click'] is True: | ||
932 | 1535 | self.hide_list() | ||
933 | 1379 | return | 1536 | return |
934 | 1380 | 1537 | ||
935 | 1381 | # Make a list of the windows in group with the bottom most | 1538 | # Make a list of the windows in group with the bottom most |
936 | @@ -1386,8 +1543,7 @@ | |||
937 | 1386 | # topmost windows. | 1543 | # topmost windows. |
938 | 1387 | for win in windows_stacked: | 1544 | for win in windows_stacked: |
939 | 1388 | if (not win.is_skip_tasklist()) and (not win.is_minimized()) \ | 1545 | if (not win.is_skip_tasklist()) and (not win.is_minimized()) \ |
942 | 1389 | and (win.get_window_type() in [wnck.WINDOW_NORMAL, | 1546 | and (win.get_window_type() in [wnck.WINDOW_NORMAL,wnck.WINDOW_DIALOG]): |
941 | 1390 | wnck.WINDOW_DIALOG]): | ||
943 | 1391 | if win in self.windows: | 1547 | if win in self.windows: |
944 | 1392 | ignored = False | 1548 | ignored = False |
945 | 1393 | if not win.is_pinned() and win.get_workspace() != None \ | 1549 | if not win.is_pinned() and win.get_workspace() != None \ |
946 | @@ -1420,9 +1576,8 @@ | |||
947 | 1420 | grtop = False | 1576 | grtop = False |
948 | 1421 | 1577 | ||
949 | 1422 | if not grp_win_stacked and mode == 'switch': | 1578 | if not grp_win_stacked and mode == 'switch': |
953 | 1423 | # Put the windows in dictionaries according to workspace and | 1579 | # Put the windows in dictionaries according to workspace and viewport |
954 | 1424 | # viewport so we can compare which workspace and viewport that | 1580 | # so we can compare which workspace and viewport that has most windows. |
952 | 1425 | # has most windows. | ||
955 | 1426 | workspaces ={} | 1581 | workspaces ={} |
956 | 1427 | for win in self.windows: | 1582 | for win in self.windows: |
957 | 1428 | if win.get_workspace() == None: | 1583 | if win.get_workspace() == None: |
958 | @@ -1457,8 +1612,8 @@ | |||
959 | 1457 | grp_win_stacked = vp | 1612 | grp_win_stacked = vp |
960 | 1458 | elif nr == max: | 1613 | elif nr == max: |
961 | 1459 | # Check wether this workspace or previous workspace | 1614 | # Check wether this workspace or previous workspace |
964 | 1460 | # with the same amount of windows has been | 1615 | # with the same amount of windows has been activated |
965 | 1461 | # activated later. | 1616 | # later. |
966 | 1462 | for win in ignorelist: | 1617 | for win in ignorelist: |
967 | 1463 | if win in grp_win_stacked: | 1618 | if win in grp_win_stacked: |
968 | 1464 | break | 1619 | break |
969 | @@ -1479,7 +1634,11 @@ | |||
970 | 1479 | if win.is_minimized(): | 1634 | if win.is_minimized(): |
971 | 1480 | win.unminimize(event.time) | 1635 | win.unminimize(event.time) |
972 | 1481 | unminimized = True | 1636 | unminimized = True |
973 | 1637 | close_popup = True | ||
974 | 1482 | if unminimized: | 1638 | if unminimized: |
975 | 1639 | # before returing also close popup if at least one window got shown | ||
976 | 1640 | if close_popup is True and self.globals.settings['close_popup_on_groupbutton_click'] is True: | ||
977 | 1641 | self.hide_list() | ||
978 | 1483 | return | 1642 | return |
979 | 1484 | ordered_list = [] | 1643 | ordered_list = [] |
980 | 1485 | ignorelist.reverse() #Bottommost window fist again. | 1644 | ignorelist.reverse() #Bottommost window fist again. |
981 | @@ -1491,9 +1650,15 @@ | |||
982 | 1491 | if grtop and not moved and minimize: | 1650 | if grtop and not moved and minimize: |
983 | 1492 | for win in grp_win_stacked: | 1651 | for win in grp_win_stacked: |
984 | 1493 | self.windows[win].window.minimize() | 1652 | self.windows[win].window.minimize() |
985 | 1653 | close_popup = False | ||
986 | 1494 | if not grtop: | 1654 | if not grtop: |
987 | 1495 | for win in grp_win_stacked: | 1655 | for win in grp_win_stacked: |
988 | 1496 | self.windows[win].window.activate(event.time) | 1656 | self.windows[win].window.activate(event.time) |
989 | 1657 | close_popup = True | ||
990 | 1658 | |||
991 | 1659 | # before returing also close popup if at least one window got shown | ||
992 | 1660 | if close_popup is True and self.globals.settings['close_popup_on_groupbutton_click'] is True: | ||
993 | 1661 | self.hide_list() | ||
994 | 1497 | 1662 | ||
995 | 1498 | def action_select_only(self, widget, event): | 1663 | def action_select_only(self, widget, event): |
996 | 1499 | self.action_select_or_minimize_group(widget, event, False) | 1664 | self.action_select_or_minimize_group(widget, event, False) |
997 | @@ -1503,13 +1668,19 @@ | |||
998 | 1503 | if len(wins) > 1: | 1668 | if len(wins) > 1: |
999 | 1504 | self.action_compiz_scale_windows(widget, event) | 1669 | self.action_compiz_scale_windows(widget, event) |
1000 | 1505 | elif len(wins) == 1: | 1670 | elif len(wins) == 1: |
1002 | 1506 | self.windows[wins[0]].action_select_window(widget, event) | 1671 | self.windows[wins[0]].action_select_window(widget, event, close_popup = True) |
1003 | 1507 | 1672 | ||
1004 | 1508 | def action_minimize_all_windows(self,widget=None, event=None): | 1673 | def action_minimize_all_windows(self,widget=None, event=None): |
1005 | 1674 | # no need to hide list - user can that way select any specific window when all minimized | ||
1006 | 1675 | #self.hide_list() | ||
1007 | 1676 | |||
1008 | 1509 | for window in self.get_windows(): | 1677 | for window in self.get_windows(): |
1009 | 1510 | window.minimize() | 1678 | window.minimize() |
1010 | 1511 | 1679 | ||
1011 | 1512 | def action_maximize_all_windows(self,widget=None, event=None): | 1680 | def action_maximize_all_windows(self,widget=None, event=None): |
1012 | 1681 | # should hide popup list first | ||
1013 | 1682 | if self.globals.settings['close_popup_on_groupbutton_click'] is True: | ||
1014 | 1683 | self.hide_list() | ||
1015 | 1513 | try: | 1684 | try: |
1016 | 1514 | action_maximize = wnck.WINDOW_ACTION_MAXIMIZE | 1685 | action_maximize = wnck.WINDOW_ACTION_MAXIMIZE |
1017 | 1515 | except: | 1686 | except: |
1018 | @@ -1559,7 +1730,10 @@ | |||
1019 | 1559 | # Just a safety check | 1730 | # Just a safety check |
1020 | 1560 | if not win in self.windows: | 1731 | if not win in self.windows: |
1021 | 1561 | return | 1732 | return |
1022 | 1733 | |||
1023 | 1562 | self.windows[win].action_select_window(widget, event) | 1734 | self.windows[win].action_select_window(widget, event) |
1024 | 1735 | # do not know if it is better to close popup or leave it open | ||
1025 | 1736 | #self.windows[win].action_select_window(widget, event, close_popup = True) | ||
1026 | 1563 | if previous: | 1737 | if previous: |
1027 | 1564 | self.nextlist.insert(0, win) | 1738 | self.nextlist.insert(0, win) |
1028 | 1565 | else: | 1739 | else: |
1029 | @@ -1578,6 +1752,8 @@ | |||
1030 | 1578 | self.hide_list_request) | 1752 | self.hide_list_request) |
1031 | 1579 | 1753 | ||
1032 | 1580 | def action_close_all_windows(self, widget=None, event=None): | 1754 | def action_close_all_windows(self, widget=None, event=None): |
1033 | 1755 | # should hide popup list first | ||
1034 | 1756 | self.hide_list() | ||
1035 | 1581 | if event: | 1757 | if event: |
1036 | 1582 | t = event.time | 1758 | t = event.time |
1037 | 1583 | else: | 1759 | else: |
1038 | @@ -1586,6 +1762,9 @@ | |||
1039 | 1586 | window.close(t) | 1762 | window.close(t) |
1040 | 1587 | 1763 | ||
1041 | 1588 | def action_launch_application(self, widget=None, event=None): | 1764 | def action_launch_application(self, widget=None, event=None): |
1042 | 1765 | # should hide popup list first | ||
1043 | 1766 | if self.globals.settings['close_popup_on_groupbutton_click'] is True: | ||
1044 | 1767 | self.hide_list() | ||
1045 | 1589 | if self.lastlaunch != None \ | 1768 | if self.lastlaunch != None \ |
1046 | 1590 | and time() - self.lastlaunch < 2: | 1769 | and time() - self.lastlaunch < 2: |
1047 | 1591 | return | 1770 | return |
1048 | @@ -1599,11 +1778,9 @@ | |||
1049 | 1599 | self.launch_effect = True | 1778 | self.launch_effect = True |
1050 | 1600 | self.update_state() | 1779 | self.update_state() |
1051 | 1601 | if self.windows: | 1780 | if self.windows: |
1054 | 1602 | self.launch_effect_timeout = gobject.timeout_add(2000, | 1781 | self.launch_effect_timeout = gobject.timeout_add(2000, self.remove_launch_effect) |
1053 | 1603 | self.remove_launch_effect) | ||
1055 | 1604 | else: | 1782 | else: |
1058 | 1605 | self.launch_effect_timeout = gobject.timeout_add(10000, | 1783 | self.launch_effect_timeout = gobject.timeout_add(10000, self.remove_launch_effect) |
1057 | 1606 | self.remove_launch_effect) | ||
1059 | 1607 | 1784 | ||
1060 | 1608 | 1785 | ||
1061 | 1609 | def action_show_menu(self, widget, event): | 1786 | def action_show_menu(self, widget, event): |
1062 | @@ -1625,15 +1802,13 @@ | |||
1063 | 1625 | #Launch program item | 1802 | #Launch program item |
1064 | 1626 | launch_program_item = gtk.MenuItem(_('_Launch application')) | 1803 | launch_program_item = gtk.MenuItem(_('_Launch application')) |
1065 | 1627 | menu.append(launch_program_item) | 1804 | menu.append(launch_program_item) |
1068 | 1628 | launch_program_item.connect("activate", | 1805 | launch_program_item.connect("activate", self.action_launch_application) |
1067 | 1629 | self.action_launch_application) | ||
1069 | 1630 | launch_program_item.show() | 1806 | launch_program_item.show() |
1070 | 1631 | if self.launcher: | 1807 | if self.launcher: |
1071 | 1632 | #Remove launcher item | 1808 | #Remove launcher item |
1072 | 1633 | remove_launcher_item = gtk.MenuItem(_('Unpin application')) | 1809 | remove_launcher_item = gtk.MenuItem(_('Unpin application')) |
1073 | 1634 | menu.append(remove_launcher_item) | 1810 | menu.append(remove_launcher_item) |
1076 | 1635 | remove_launcher_item.connect("activate", | 1811 | remove_launcher_item.connect("activate", self.action_remove_launcher) |
1075 | 1636 | self.action_remove_launcher) | ||
1077 | 1637 | remove_launcher_item.show() | 1812 | remove_launcher_item.show() |
1078 | 1638 | #Edit identifier item | 1813 | #Edit identifier item |
1079 | 1639 | edit_identifier_item = gtk.MenuItem(_('Edit Identifier')) | 1814 | edit_identifier_item = gtk.MenuItem(_('Edit Identifier')) |
1080 | @@ -1683,7 +1858,6 @@ | |||
1081 | 1683 | sep = gtk.SeparatorMenuItem() | 1858 | sep = gtk.SeparatorMenuItem() |
1082 | 1684 | menu.append(sep) | 1859 | menu.append(sep) |
1083 | 1685 | sep.show() | 1860 | sep.show() |
1084 | 1686 | # Windows stuff | ||
1085 | 1687 | win_nr = self.get_windows_count() | 1861 | win_nr = self.get_windows_count() |
1086 | 1688 | if win_nr: | 1862 | if win_nr: |
1087 | 1689 | if win_nr == 1: | 1863 | if win_nr == 1: |
1088 | @@ -1723,13 +1897,14 @@ | |||
1089 | 1723 | # Close all | 1897 | # Close all |
1090 | 1724 | close_all_windows_item = gtk.MenuItem('%s%s'%(_("_Close"), t)) | 1898 | close_all_windows_item = gtk.MenuItem('%s%s'%(_("_Close"), t)) |
1091 | 1725 | menu.append(close_all_windows_item) | 1899 | menu.append(close_all_windows_item) |
1094 | 1726 | close_all_windows_item.connect("activate", | 1900 | close_all_windows_item.connect("activate", self.action_close_all_windows) |
1093 | 1727 | self.action_close_all_windows) | ||
1095 | 1728 | close_all_windows_item.show() | 1901 | close_all_windows_item.show() |
1096 | 1729 | menu.popup(None, None, None, event.button, event.time) | 1902 | menu.popup(None, None, None, event.button, event.time) |
1097 | 1730 | self.globals.right_menu_showing = True | 1903 | self.globals.right_menu_showing = True |
1098 | 1731 | 1904 | ||
1099 | 1732 | def action_remove_launcher(self, widget=None, event=None): | 1905 | def action_remove_launcher(self, widget=None, event=None): |
1100 | 1906 | # should hide popup list first | ||
1101 | 1907 | self.hide_list() | ||
1102 | 1733 | print 'Removing launcher ', self.identifier | 1908 | print 'Removing launcher ', self.identifier |
1103 | 1734 | if self.identifier: | 1909 | if self.identifier: |
1104 | 1735 | name = self.identifier | 1910 | name = self.identifier |
1105 | @@ -1756,7 +1931,7 @@ | |||
1106 | 1756 | if not self.class_group or not wins: | 1931 | if not self.class_group or not wins: |
1107 | 1757 | return | 1932 | return |
1108 | 1758 | if len(wins) == 1: | 1933 | if len(wins) == 1: |
1110 | 1759 | self.windows[wins[0]].action_select_window(widget, event) | 1934 | self.windows[wins[0]].action_select_window(widget, event, close_popup = True) |
1111 | 1760 | return | 1935 | return |
1112 | 1761 | if self.globals.settings['show_only_current_desktop']: | 1936 | if self.globals.settings['show_only_current_desktop']: |
1113 | 1762 | path = 'scale/allscreens/initiate_key' | 1937 | path = 'scale/allscreens/initiate_key' |
1114 | @@ -1769,15 +1944,20 @@ | |||
1115 | 1769 | return | 1944 | return |
1116 | 1770 | # A new button enter signal is sent when compiz is called, | 1945 | # A new button enter signal is sent when compiz is called, |
1117 | 1771 | # a delay is therefor needed. | 1946 | # a delay is therefor needed. |
1120 | 1772 | gobject.timeout_add(self.globals.settings['popup_delay'] + 200, | 1947 | if self.globals.settings['disable_popup_on_groupbutton_click'] is True: |
1121 | 1773 | self.hide_list) | 1948 | # there is no problem with aditional compiz call since popup list |
1122 | 1949 | # is disabled on any click (self.disable_popup_delay) | ||
1123 | 1950 | self.hide_list() | ||
1124 | 1951 | else: | ||
1125 | 1952 | gobject.timeout_add(settings['popup_delay'] + 200, self.hide_list) | ||
1126 | 1953 | |||
1127 | 1774 | 1954 | ||
1128 | 1775 | def action_compiz_shift_windows(self, widget, event): | 1955 | def action_compiz_shift_windows(self, widget, event): |
1129 | 1776 | wins = self.get_unminimized_windows() | 1956 | wins = self.get_unminimized_windows() |
1130 | 1777 | if not self.class_group or not wins: | 1957 | if not self.class_group or not wins: |
1131 | 1778 | return | 1958 | return |
1132 | 1779 | if len(wins) == 1: | 1959 | if len(wins) == 1: |
1134 | 1780 | self.windows[wins[0]].action_select_window(widget, event) | 1960 | self.windows[wins[0]].action_select_window(widget, event, close_popup = True) |
1135 | 1781 | return | 1961 | return |
1136 | 1782 | 1962 | ||
1137 | 1783 | if self.globals.settings['show_only_current_desktop']: | 1963 | if self.globals.settings['show_only_current_desktop']: |
1138 | @@ -1791,42 +1971,51 @@ | |||
1139 | 1791 | return | 1971 | return |
1140 | 1792 | # A new button enter signal is sent when compiz is called, | 1972 | # A new button enter signal is sent when compiz is called, |
1141 | 1793 | # a delay is therefor needed. | 1973 | # a delay is therefor needed. |
1144 | 1794 | gobject.timeout_add(self.globals.settings['popup_delay']+ 200, | 1974 | if self.globals.settings['disable_popup_on_groupbutton_click'] is True: |
1145 | 1795 | self.hide_list) | 1975 | # there is no problem with aditional compiz call since popup list |
1146 | 1976 | # is disabled on any click (self.disable_popup_delay) | ||
1147 | 1977 | self.hide_list() | ||
1148 | 1978 | else: | ||
1149 | 1979 | gobject.timeout_add(settings['popup_delay']+ 200, self.hide_list) | ||
1150 | 1796 | 1980 | ||
1151 | 1797 | def action_compiz_scale_all(self, widget, event): | 1981 | def action_compiz_scale_all(self, widget, event): |
1152 | 1798 | try: | 1982 | try: |
1155 | 1799 | compiz_call('scale/allscreens/initiate_key', 'activate', | 1983 | compiz_call('scale/allscreens/initiate_key','activate','root', self.root_xid) |
1154 | 1800 | 'root', self.root_xid) | ||
1156 | 1801 | except: | 1984 | except: |
1157 | 1802 | return | 1985 | return |
1158 | 1803 | # A new button enter signal is sent when compiz is called, | 1986 | # A new button enter signal is sent when compiz is called, |
1159 | 1804 | # a delay is therefor needed. | 1987 | # a delay is therefor needed. |
1162 | 1805 | gobject.timeout_add(self.globals.settings['popup_delay']+ 200, | 1988 | if self.globals.settings['disable_popup_on_groupbutton_click'] is True: |
1163 | 1806 | self.hide_list) | 1989 | # there is no problem with aditional compiz call since popup list |
1164 | 1990 | # is disabled on any click (self.disable_popup_delay) | ||
1165 | 1991 | self.hide_list() | ||
1166 | 1992 | else: | ||
1167 | 1993 | gobject.timeout_add(settings['popup_delay']+ 200, self.hide_list) | ||
1168 | 1807 | 1994 | ||
1169 | 1808 | def action_dbpref (self,widget=None, event=None): | 1995 | def action_dbpref (self,widget=None, event=None): |
1170 | 1809 | # Preferences dialog | 1996 | # Preferences dialog |
1171 | 1810 | self.emit('launch-preference') | 1997 | self.emit('launch-preference') |
1172 | 1811 | 1998 | ||
1173 | 1812 | def action_none(self, widget = None, event = None): | 1999 | def action_none(self, widget = None, event = None): |
1174 | 2000 | # if there is no action then reenable popup list | ||
1175 | 2001 | self.disable_popup_delay = False | ||
1176 | 1813 | pass | 2002 | pass |
1177 | 1814 | 2003 | ||
1178 | 1815 | action_function_dict = \ | ||
1179 | 1816 | ODict(( | ||
1180 | 1817 | ("select", action_select), | ||
1181 | 1818 | ("close all windows", action_close_all_windows), | ||
1182 | 1819 | ("minimize all windows", action_minimize_all_windows), | ||
1183 | 1820 | ("maximize all windows", action_maximize_all_windows), | ||
1184 | 1821 | ("launch application", action_launch_application), | ||
1185 | 1822 | ("show menu", action_show_menu), | ||
1186 | 1823 | ("remove launcher", action_remove_launcher), | ||
1187 | 1824 | ("select next window", action_select_next), | ||
1188 | 1825 | ("select previous window", action_select_previous), | ||
1189 | 1826 | ("minimize all other groups", action_minimize_all_other_groups), | ||
1190 | 1827 | ("compiz scale windows", action_compiz_scale_windows), | ||
1191 | 1828 | ("compiz shift windows", action_compiz_shift_windows), | ||
1192 | 1829 | ("compiz scale all", action_compiz_scale_all), | ||
1193 | 1830 | ("show preference dialog", action_dbpref), | ||
1194 | 1831 | ("no action", action_none) | ||
1195 | 1832 | )) | ||
1196 | 1833 | \ No newline at end of file | 2004 | \ No newline at end of file |
1197 | 2005 | action_function_dict = ODict(( | ||
1198 | 2006 | ("select", action_select), | ||
1199 | 2007 | ("close all windows", action_close_all_windows), | ||
1200 | 2008 | ("minimize all windows", action_minimize_all_windows), | ||
1201 | 2009 | ("maximize all windows", action_maximize_all_windows), | ||
1202 | 2010 | ("launch application", action_launch_application), | ||
1203 | 2011 | ("show menu", action_show_menu), | ||
1204 | 2012 | ("remove launcher", action_remove_launcher), | ||
1205 | 2013 | ("select next window", action_select_next), | ||
1206 | 2014 | ("select previous window", action_select_previous), | ||
1207 | 2015 | ("minimize all other groups", action_minimize_all_other_groups), | ||
1208 | 2016 | ("compiz scale windows", action_compiz_scale_windows), | ||
1209 | 2017 | ("compiz shift windows", action_compiz_shift_windows), | ||
1210 | 2018 | ("compiz scale all", action_compiz_scale_all), | ||
1211 | 2019 | ("show preference dialog", action_dbpref), | ||
1212 | 2020 | ("no action", action_none) | ||
1213 | 2021 | )) | ||
1214 | 2022 | |||
1215 | 1834 | 2023 | ||
1216 | === modified file 'dockbarx/i18n.py' (properties changed: -x to +x) | |||
1217 | === modified file 'dockbarx/iconfactory.py' (properties changed: -x to +x) | |||
1218 | --- dockbarx/iconfactory.py 2010-06-29 16:11:43 +0000 | |||
1219 | +++ dockbarx/iconfactory.py 2010-07-05 16:50:40 +0000 | |||
1220 | @@ -45,6 +45,7 @@ | |||
1221 | 45 | LAUNCHER = 1<<6 | 45 | LAUNCHER = 1<<6 |
1222 | 46 | # Icon effects | 46 | # Icon effects |
1223 | 47 | MOUSE_OVER = 1<<7 | 47 | MOUSE_OVER = 1<<7 |
1224 | 48 | MOUSE_BUTTON_DOWN = 1<<13 | ||
1225 | 48 | NEEDS_ATTENTION = 1<<8 | 49 | NEEDS_ATTENTION = 1<<8 |
1226 | 49 | BLINK = 1<<9 | 50 | BLINK = 1<<9 |
1227 | 50 | # ACTIVE_WINDOW | 51 | # ACTIVE_WINDOW |
1228 | @@ -56,6 +57,7 @@ | |||
1229 | 56 | 'all_minimized':ALL_MINIMIZED, | 57 | 'all_minimized':ALL_MINIMIZED, |
1230 | 57 | 'launcher':LAUNCHER, | 58 | 'launcher':LAUNCHER, |
1231 | 58 | 'mouse_over':MOUSE_OVER, | 59 | 'mouse_over':MOUSE_OVER, |
1232 | 60 | 'mouse_button_down':MOUSE_BUTTON_DOWN, | ||
1233 | 59 | 'needs_attention':NEEDS_ATTENTION, | 61 | 'needs_attention':NEEDS_ATTENTION, |
1234 | 60 | 'blink':BLINK, | 62 | 'blink':BLINK, |
1235 | 61 | 'active':ACTIVE, | 63 | 'active':ACTIVE, |
1236 | @@ -104,9 +106,6 @@ | |||
1237 | 104 | 106 | ||
1238 | 105 | 107 | ||
1239 | 106 | def set_size(self, size): | 108 | def set_size(self, size): |
1240 | 107 | if size <= 0: | ||
1241 | 108 | # To avoid chrashes. | ||
1242 | 109 | size = 15 | ||
1243 | 110 | self.size = size | 109 | self.size = size |
1244 | 111 | self.surfaces = {} | 110 | self.surfaces = {} |
1245 | 112 | self.average_color = None | 111 | self.average_color = None |
1246 | @@ -120,8 +119,7 @@ | |||
1247 | 120 | 119 | ||
1248 | 121 | 120 | ||
1249 | 122 | def surface_update(self, type = 0): | 121 | def surface_update(self, type = 0): |
1252 | 123 | # Checks if the requested pixbuf is already | 122 | # Checks if the requested pixbuf is already drawn and returns it if it is. |
1251 | 124 | # drawn and returns it if it is. | ||
1253 | 125 | # Othervice the surface is drawn, saved and returned. | 123 | # Othervice the surface is drawn, saved and returned. |
1254 | 126 | self.win_nr = type & 15 | 124 | self.win_nr = type & 15 |
1255 | 127 | if self.win_nr > self.max_win_nr: | 125 | if self.win_nr > self.max_win_nr: |
1256 | @@ -445,8 +443,7 @@ | |||
1257 | 445 | def find_icon_pixbuf(self, size): | 443 | def find_icon_pixbuf(self, size): |
1258 | 446 | # Returns the icon pixbuf for the program. Uses the following metods: | 444 | # Returns the icon pixbuf for the program. Uses the following metods: |
1259 | 447 | 445 | ||
1262 | 448 | # 1) If it is a launcher, return the icon from the | 446 | # 1) If it is a launcher, return the icon from the launcher's desktopfile |
1261 | 449 | # launcher's desktopfile | ||
1263 | 450 | # 2) Get the icon from the gio app | 447 | # 2) Get the icon from the gio app |
1264 | 451 | # 3) Check if the res_class fits an themed icon. | 448 | # 3) Check if the res_class fits an themed icon. |
1265 | 452 | # 4) Search in path after a icon matching reclass. | 449 | # 4) Search in path after a icon matching reclass. |
1266 | @@ -464,8 +461,7 @@ | |||
1267 | 464 | icon = self.app.get_icon() | 461 | icon = self.app.get_icon() |
1268 | 465 | if icon.__class__ == gio.FileIcon: | 462 | if icon.__class__ == gio.FileIcon: |
1269 | 466 | if icon.get_file().query_exists(None): | 463 | if icon.get_file().query_exists(None): |
1272 | 467 | pixbuf = self.icon_from_file_name( | 464 | pixbuf = self.icon_from_file_name(icon.get_file().get_path(), size) |
1271 | 468 | icon.get_file().get_path(), size) | ||
1273 | 469 | if pixbuf != None: | 465 | if pixbuf != None: |
1274 | 470 | return pixbuf | 466 | return pixbuf |
1275 | 471 | elif icon.__class__ == gio.ThemedIcon: | 467 | elif icon.__class__ == gio.ThemedIcon: |
1276 | @@ -504,8 +500,7 @@ | |||
1277 | 504 | # If no pixbuf has been found (can only happen for an unlaunched | 500 | # If no pixbuf has been found (can only happen for an unlaunched |
1278 | 505 | # launcher), make an empty pixbuf and show a warning. | 501 | # launcher), make an empty pixbuf and show a warning. |
1279 | 506 | if self.icon_theme.has_icon('application-default-icon'): | 502 | if self.icon_theme.has_icon('application-default-icon'): |
1282 | 507 | pixbuf = self.icon_theme.load_icon('application-default-icon', | 503 | pixbuf = self.icon_theme.load_icon('application-default-icon',size,0) |
1281 | 508 | size, 0) | ||
1283 | 509 | else: | 504 | else: |
1284 | 510 | pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, size,size) | 505 | pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, size,size) |
1285 | 511 | pixbuf.fill(0x00000000) | 506 | pixbuf.fill(0x00000000) |
1286 | @@ -529,8 +524,7 @@ | |||
1287 | 529 | def icon_from_file_name(self, icon_name, icon_size = -1): | 524 | def icon_from_file_name(self, icon_name, icon_size = -1): |
1288 | 530 | if os.path.isfile(icon_name): | 525 | if os.path.isfile(icon_name): |
1289 | 531 | try: | 526 | try: |
1292 | 532 | return gtk.gdk.pixbuf_new_from_file_at_size(icon_name, -1, | 527 | return gtk.gdk.pixbuf_new_from_file_at_size(icon_name, -1, icon_size) |
1291 | 533 | icon_size) | ||
1293 | 534 | except: | 528 | except: |
1294 | 535 | pass | 529 | pass |
1295 | 536 | return None | 530 | return None |
1296 | 537 | 531 | ||
1297 | === modified file 'dockbarx/theme.py' (properties changed: -x to +x) | |||
1298 | === modified file 'dockbarx/windowbutton.py' (properties changed: -x to +x) | |||
1299 | --- dockbarx/windowbutton.py 2010-06-22 11:15:41 +0000 | |||
1300 | +++ dockbarx/windowbutton.py 2010-07-05 16:50:40 +0000 | |||
1301 | @@ -78,22 +78,14 @@ | |||
1302 | 78 | 78 | ||
1303 | 79 | 79 | ||
1304 | 80 | #--- Events | 80 | #--- Events |
1321 | 81 | self.window_button.connect("enter-notify-event", | 81 | self.window_button.connect("enter-notify-event",self.on_button_mouse_enter) |
1322 | 82 | self.on_button_mouse_enter) | 82 | self.window_button.connect("leave-notify-event",self.on_button_mouse_leave) |
1323 | 83 | self.window_button.connect("leave-notify-event", | 83 | self.window_button.connect("button-press-event",self.on_window_button_press_event) |
1324 | 84 | self.on_button_mouse_leave) | 84 | self.window_button.connect("button-release-event",self.on_window_button_release_event) |
1325 | 85 | self.window_button.connect("button-press-event", | 85 | self.window_button.connect("scroll-event",self.on_window_button_scroll_event) |
1326 | 86 | self.on_window_button_press_event) | 86 | self.state_changed_event = self.window.connect("state-changed",self.on_window_state_changed) |
1327 | 87 | self.window_button.connect("button-release-event", | 87 | self.icon_changed_event = self.window.connect("icon-changed",self.on_window_icon_changed) |
1328 | 88 | self.on_window_button_release_event) | 88 | self.name_changed_event = self.window.connect("name-changed",self.on_window_name_changed) |
1313 | 89 | self.window_button.connect("scroll-event", | ||
1314 | 90 | self.on_window_button_scroll_event) | ||
1315 | 91 | self.state_changed_event = self.window.connect("state-changed", | ||
1316 | 92 | self.on_window_state_changed) | ||
1317 | 93 | self.icon_changed_event = self.window.connect("icon-changed", | ||
1318 | 94 | self.on_window_icon_changed) | ||
1319 | 95 | self.name_changed_event = self.window.connect("name-changed", | ||
1320 | 96 | self.on_window_name_changed) | ||
1329 | 97 | 89 | ||
1330 | 98 | #--- D'n'D | 90 | #--- D'n'D |
1331 | 99 | self.window_button.drag_dest_set(gtk.DEST_DEFAULT_HIGHLIGHT, [], 0) | 91 | self.window_button.drag_dest_set(gtk.DEST_DEFAULT_HIGHLIGHT, [], 0) |
1332 | @@ -103,6 +95,7 @@ | |||
1333 | 103 | self.dnd_select_window = None | 95 | self.dnd_select_window = None |
1334 | 104 | 96 | ||
1335 | 105 | 97 | ||
1336 | 98 | |||
1337 | 106 | def set_button_active(self, mode): | 99 | def set_button_active(self, mode): |
1338 | 107 | self.is_active_window = mode | 100 | self.is_active_window = mode |
1339 | 108 | self.update_label_state() | 101 | self.update_label_state() |
1340 | @@ -280,22 +273,18 @@ | |||
1341 | 280 | # to this windowbutton transparent. | 273 | # to this windowbutton transparent. |
1342 | 281 | if self.globals.opacity_values == None: | 274 | if self.globals.opacity_values == None: |
1343 | 282 | try: | 275 | try: |
1346 | 283 | self.globals.opacity_values = compiz_call( | 276 | self.dockbar.opacity_values = compiz_call('obs/screen0/opacity_values','get') |
1345 | 284 | 'obs/screen0/opacity_values','get') | ||
1347 | 285 | except: | 277 | except: |
1348 | 286 | try: | 278 | try: |
1351 | 287 | self.globals.opacity_values = compiz_call( | 279 | self.dockbar.opacity_values = compiz_call('core/screen0/opacity_values','get') |
1350 | 288 | 'core/screen0/opacity_values','get') | ||
1352 | 289 | except: | 280 | except: |
1353 | 290 | return | 281 | return |
1354 | 291 | if self.globals.opacity_matches == None: | 282 | if self.globals.opacity_matches == None: |
1355 | 292 | try: | 283 | try: |
1358 | 293 | self.globals.opacity_matches = compiz_call( | 284 | self.dockbar.opacity_matches = compiz_call('obs/screen0/opacity_matches','get') |
1357 | 294 | 'obs/screen0/opacity_matches','get') | ||
1359 | 295 | except: | 285 | except: |
1360 | 296 | try: | 286 | try: |
1363 | 297 | self.globals.opacity_matches = compiz_call( | 287 | self.dockbar.opacity_values = compiz_call('core/screen0/opacity_matches','get') |
1362 | 298 | 'core/screen0/opacity_matches','get') | ||
1364 | 299 | except: | 288 | except: |
1365 | 300 | return | 289 | return |
1366 | 301 | self.globals.opacified = True | 290 | self.globals.opacified = True |
1367 | @@ -339,16 +328,12 @@ | |||
1368 | 339 | if self.globals.opacity_values == None: | 328 | if self.globals.opacity_values == None: |
1369 | 340 | return False | 329 | return False |
1370 | 341 | try: | 330 | try: |
1375 | 342 | compiz_call('obs/screen0/opacity_values','set', | 331 | compiz_call('obs/screen0/opacity_values','set', self.dockbar.opacity_values) |
1376 | 343 | self.globals.opacity_values) | 332 | compiz_call('obs/screen0/opacity_matches','set', self.dockbar.opacity_matches) |
1373 | 344 | compiz_call('obs/screen0/opacity_matches','set', | ||
1374 | 345 | self.globals.opacity_matches) | ||
1377 | 346 | except: | 333 | except: |
1378 | 347 | try: | 334 | try: |
1383 | 348 | compiz_call('core/screen0/opacity_values','set', | 335 | compiz_call('core/screen0/opacity_values','set', self.dockbar.opacity_values) |
1384 | 349 | self.globals.opacity_values) | 336 | compiz_call('core/screen0/opacity_matches','set', self.dockbar.opacity_matches) |
1381 | 350 | compiz_call('core/screen0/opacity_matches','set', | ||
1382 | 351 | self.globals.opacity_matches) | ||
1385 | 352 | except: | 337 | except: |
1386 | 353 | print "Error: Couldn't set opacity back to normal." | 338 | print "Error: Couldn't set opacity back to normal." |
1387 | 354 | self.globals.opacity_values = None | 339 | self.globals.opacity_values = None |
1388 | @@ -361,8 +346,7 @@ | |||
1389 | 361 | # Make sure that mouse cursor really has left the window button. | 346 | # Make sure that mouse cursor really has left the window button. |
1390 | 362 | b_m_x,b_m_y = self.window_button.get_pointer() | 347 | b_m_x,b_m_y = self.window_button.get_pointer() |
1391 | 363 | b_r = self.window_button.get_allocation() | 348 | b_r = self.window_button.get_allocation() |
1394 | 364 | if b_m_x >= 0 and b_m_x < b_r.width \ | 349 | if (b_m_x>=0 and b_m_x<b_r.width) and (b_m_y >= 0 and b_m_y < b_r.height): |
1393 | 365 | and b_m_y >= 0 and b_m_y < b_r.height: | ||
1395 | 366 | return True | 350 | return True |
1396 | 367 | self.globals.opacified = False | 351 | self.globals.opacified = False |
1397 | 368 | self.opacified = False | 352 | self.opacified = False |
1398 | @@ -390,8 +374,7 @@ | |||
1399 | 390 | 374 | ||
1400 | 391 | #### Events | 375 | #### Events |
1401 | 392 | def on_button_mouse_enter(self, widget, event): | 376 | def on_button_mouse_enter(self, widget, event): |
1404 | 393 | # In compiz there is a enter and | 377 | # In compiz there is a enter and a leave event before a button_press event. |
1403 | 394 | # a leave event before a button_press event. | ||
1405 | 395 | # Keep that in mind when coding this def! | 378 | # Keep that in mind when coding this def! |
1406 | 396 | if self.button_pressed : | 379 | if self.button_pressed : |
1407 | 397 | return | 380 | return |
1408 | @@ -402,8 +385,7 @@ | |||
1409 | 402 | gobject.timeout_add(500, self.deopacify_request) | 385 | gobject.timeout_add(500, self.deopacify_request) |
1410 | 403 | 386 | ||
1411 | 404 | def on_button_mouse_leave(self, widget, event): | 387 | def on_button_mouse_leave(self, widget, event): |
1414 | 405 | # In compiz there is a enter and a leave | 388 | # In compiz there is a enter and a leave event before a button_press event. |
1413 | 406 | # event before a button_press event. | ||
1415 | 407 | # Keep that in mind when coding this def! | 389 | # Keep that in mind when coding this def! |
1416 | 408 | self.button_pressed = False | 390 | self.button_pressed = False |
1417 | 409 | self.update_label_state(False) | 391 | self.update_label_state(False) |
1418 | @@ -411,11 +393,9 @@ | |||
1419 | 411 | self.deopacify_request() | 393 | self.deopacify_request() |
1420 | 412 | 394 | ||
1421 | 413 | def on_window_button_press_event(self, widget,event): | 395 | def on_window_button_press_event(self, widget,event): |
1424 | 414 | # In compiz there is a enter and a leave event before | 396 | # In compiz there is a enter and a leave event before a button_press event. |
1423 | 415 | # a button_press event. | ||
1425 | 416 | # self.button_pressed is used to stop functions started with | 397 | # self.button_pressed is used to stop functions started with |
1428 | 417 | # gobject.timeout_add from self.on_button_mouse_enter | 398 | # gobject.timeout_add from self.on_button_mouse_enter or self.on_button_mouse_leave. |
1427 | 418 | # or self.on_button_mouse_leave. | ||
1429 | 419 | self.button_pressed = True | 399 | self.button_pressed = True |
1430 | 420 | gobject.timeout_add(600, self.set_button_pressed_false) | 400 | gobject.timeout_add(600, self.set_button_pressed_false) |
1431 | 421 | 401 | ||
1432 | @@ -432,9 +412,13 @@ | |||
1433 | 432 | if event.direction == gtk.gdk.SCROLL_UP: | 412 | if event.direction == gtk.gdk.SCROLL_UP: |
1434 | 433 | action = self.globals.settings['windowbutton_scroll_up'] | 413 | action = self.globals.settings['windowbutton_scroll_up'] |
1435 | 434 | self.action_function_dict[action](self, widget, event) | 414 | self.action_function_dict[action](self, widget, event) |
1436 | 415 | if self.globals.settings['windowbutton_close_popup_on_scroll_up'] is True: | ||
1437 | 416 | self.emit('popup-hide', None) | ||
1438 | 435 | elif event.direction == gtk.gdk.SCROLL_DOWN: | 417 | elif event.direction == gtk.gdk.SCROLL_DOWN: |
1439 | 436 | action = self.globals.settings['windowbutton_scroll_down'] | 418 | action = self.globals.settings['windowbutton_scroll_down'] |
1440 | 437 | self.action_function_dict[action](self, widget, event) | 419 | self.action_function_dict[action](self, widget, event) |
1441 | 420 | if self.globals.settings['windowbutton_close_popup_on_scroll_down'] is True: | ||
1442 | 421 | self.emit('popup-hide', None) | ||
1443 | 438 | 422 | ||
1444 | 439 | def on_window_button_release_event(self, widget,event): | 423 | def on_window_button_release_event(self, widget,event): |
1445 | 440 | if self.globals.settings["opacify"]and self.opacified: | 424 | if self.globals.settings["opacify"]and self.opacified: |
1446 | @@ -442,26 +426,36 @@ | |||
1447 | 442 | self.opacified = False | 426 | self.opacified = False |
1448 | 443 | self.deopacify() | 427 | self.deopacify() |
1449 | 444 | if event.button == 1 and event.state & gtk.gdk.SHIFT_MASK : | 428 | if event.button == 1 and event.state & gtk.gdk.SHIFT_MASK : |
1452 | 445 | action = self.globals.settings[ | 429 | action = self.globals.settings['windowbutton_shift_and_left_click_action'] |
1451 | 446 | 'windowbutton_shift_and_left_click_action'] | ||
1453 | 447 | self.action_function_dict[action](self, widget, event) | 430 | self.action_function_dict[action](self, widget, event) |
1454 | 431 | if self.globals.settings['windowbutton_close_popup_on_shift_and_left_click'] is True: | ||
1455 | 432 | self.emit('popup-hide', None) | ||
1456 | 448 | elif event.button == 1: | 433 | elif event.button == 1: |
1457 | 449 | action = self.globals.settings['windowbutton_left_click_action'] | 434 | action = self.globals.settings['windowbutton_left_click_action'] |
1458 | 450 | self.action_function_dict[action](self, widget, event) | 435 | self.action_function_dict[action](self, widget, event) |
1459 | 436 | if self.globals.settings['windowbutton_close_popup_on_left_click'] is True: | ||
1460 | 437 | self.emit('popup-hide', None) | ||
1461 | 451 | elif event.button == 2 and event.state & gtk.gdk.SHIFT_MASK: | 438 | elif event.button == 2 and event.state & gtk.gdk.SHIFT_MASK: |
1464 | 452 | action = self.globals.settings[ | 439 | action = self.globals.settings['windowbutton_shift_and_middle_click_action'] |
1463 | 453 | 'windowbutton_shift_and_middle_click_action'] | ||
1465 | 454 | self.action_function_dict[action](self, widget,event) | 440 | self.action_function_dict[action](self, widget,event) |
1466 | 441 | if self.globals.settings['windowbutton_close_popup_on_shift_and_middle_click'] is True: | ||
1467 | 442 | self.emit('popup-hide', None) | ||
1468 | 455 | elif event.button == 2: | 443 | elif event.button == 2: |
1469 | 456 | action = self.globals.settings['windowbutton_middle_click_action'] | 444 | action = self.globals.settings['windowbutton_middle_click_action'] |
1470 | 457 | self.action_function_dict[action](self, widget,event) | 445 | self.action_function_dict[action](self, widget,event) |
1471 | 446 | if self.globals.settings['windowbutton_close_popup_on_middle_click'] is True: | ||
1472 | 447 | self.emit('popup-hide', None) | ||
1473 | 458 | elif event.button == 3 and event.state & gtk.gdk.SHIFT_MASK: | 448 | elif event.button == 3 and event.state & gtk.gdk.SHIFT_MASK: |
1476 | 459 | action = self.globals.settings[ | 449 | action = self.globals.settings['windowbutton_shift_and_right_click_action'] |
1475 | 460 | 'windowbutton_shift_and_right_click_action'] | ||
1477 | 461 | self.action_function_dict[action](self, widget, event) | 450 | self.action_function_dict[action](self, widget, event) |
1478 | 451 | if self.globals.settings['windowbutton_close_popup_on_shift_and_right_click'] is True: | ||
1479 | 452 | self.emit('popup-hide', None) | ||
1480 | 462 | elif event.button == 3: | 453 | elif event.button == 3: |
1481 | 463 | action = self.globals.settings['windowbutton_right_click_action'] | 454 | action = self.globals.settings['windowbutton_right_click_action'] |
1482 | 464 | self.action_function_dict[action](self, widget, event) | 455 | self.action_function_dict[action](self, widget, event) |
1483 | 456 | if self.globals.settings['windowbutton_close_popup_on_right_click'] is True: | ||
1484 | 457 | self.emit('popup-hide', None) | ||
1485 | 458 | |||
1486 | 465 | 459 | ||
1487 | 466 | #### Menu functions | 460 | #### Menu functions |
1488 | 467 | def menu_closed(self, menushell): | 461 | def menu_closed(self, menushell): |
1489 | @@ -475,8 +469,7 @@ | |||
1490 | 475 | self.window.minimize() | 469 | self.window.minimize() |
1491 | 476 | 470 | ||
1492 | 477 | #### Actions | 471 | #### Actions |
1495 | 478 | def action_select_or_minimize_window(self, widget=None, | 472 | def action_select_or_minimize_window(self, widget=None, event=None, minimize=True, close_popup = False): |
1494 | 479 | event=None, minimize=True): | ||
1496 | 480 | # The window is activated, unless it is already | 473 | # The window is activated, unless it is already |
1497 | 481 | # activated, then it's minimized. Minimized | 474 | # activated, then it's minimized. Minimized |
1498 | 482 | # windows are unminimized. The workspace | 475 | # windows are unminimized. The workspace |
1499 | @@ -491,21 +484,27 @@ | |||
1500 | 491 | self.window.get_workspace().activate(t) | 484 | self.window.get_workspace().activate(t) |
1501 | 492 | if not self.window.is_in_viewport(self.screen.get_active_workspace()): | 485 | if not self.window.is_in_viewport(self.screen.get_active_workspace()): |
1502 | 493 | win_x,win_y,win_w,win_h = self.window.get_geometry() | 486 | win_x,win_y,win_w,win_h = self.window.get_geometry() |
1505 | 494 | self.screen.move_viewport(win_x-(win_x%self.screen.get_width()), | 487 | self.screen.move_viewport(win_x-(win_x%self.screen.get_width()),win_y-(win_y%self.screen.get_height())) |
1504 | 495 | win_y-(win_y%self.screen.get_height())) | ||
1506 | 496 | # Hide popup since mouse movment won't | 488 | # Hide popup since mouse movment won't |
1507 | 497 | # be tracked during compiz move effect | 489 | # be tracked during compiz move effect |
1508 | 498 | # which means popup list can be left open. | 490 | # which means popup list can be left open. |
1510 | 499 | self.emit('popup-hide', 'viewport-change') | 491 | #self.emit('popup-hide', 'viewport-change') |
1511 | 492 | close_popup = True | ||
1512 | 500 | if self.window.is_minimized(): | 493 | if self.window.is_minimized(): |
1513 | 501 | self.window.unminimize(t) | 494 | self.window.unminimize(t) |
1514 | 502 | elif self.window.is_active() and minimize: | 495 | elif self.window.is_active() and minimize: |
1515 | 503 | self.window.minimize() | 496 | self.window.minimize() |
1516 | 497 | close_popup = False | ||
1517 | 504 | else: | 498 | else: |
1518 | 505 | self.window.activate(t) | 499 | self.window.activate(t) |
1519 | 506 | 500 | ||
1522 | 507 | def action_select_window(self, widget = None, event = None): | 501 | # also close popup list unless if we just minimized window |
1523 | 508 | self.action_select_or_minimize_window(widget, event, False) | 502 | # but only if needed by caller or due to compiz |
1524 | 503 | if close_popup is True: | ||
1525 | 504 | self.emit('popup-hide', None) | ||
1526 | 505 | |||
1527 | 506 | def action_select_window(self, widget = None, event = None, close_popup = False): | ||
1528 | 507 | self.action_select_or_minimize_window(widget, event, False, close_popup) | ||
1529 | 509 | 508 | ||
1530 | 510 | def action_close_window(self, widget=None, event=None): | 509 | def action_close_window(self, widget=None, event=None): |
1531 | 511 | self.window.close(gtk.get_current_event_time()) | 510 | self.window.close(gtk.get_current_event_time()) |
1532 | @@ -570,8 +569,7 @@ | |||
1533 | 570 | pass | 569 | pass |
1534 | 571 | 570 | ||
1535 | 572 | action_function_dict = ODict(( | 571 | action_function_dict = ODict(( |
1538 | 573 | ('select or minimize window', | 572 | ('select or minimize window', action_select_or_minimize_window), |
1537 | 574 | action_select_or_minimize_window), | ||
1539 | 575 | ('select window', action_select_window), | 573 | ('select window', action_select_window), |
1540 | 576 | ('maximize window', action_maximize_window), | 574 | ('maximize window', action_maximize_window), |
1541 | 577 | ('close window', action_close_window), | 575 | ('close window', action_close_window), |
1542 | @@ -581,4 +579,3 @@ | |||
1543 | 581 | ('no action', action_none) | 579 | ('no action', action_none) |
1544 | 582 | )) | 580 | )) |
1545 | 583 | 581 | ||
1546 | 584 | |||
1547 | 585 | 582 | ||
1548 | === modified file 'dockbarx/zg.py' (properties changed: -x to +x) |