Merge lp:~skokec/dockbar/win7ish-feel into lp:dockbar

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
Reviewer Review Type Date Requested Status
Dockbar Main Group Pending
Review via email: mp+29224@code.launchpad.net

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
=== modified file 'dbx_preference.py'
--- dbx_preference.py 2010-06-21 04:19:21 +0000
+++ dbx_preference.py 2010-07-05 16:50:40 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/python1#!/usr/bin/python2.6
22
3# dbx_preference.py3# dbx_preference.py
4#4#
@@ -274,6 +274,24 @@
274 table.attach(label, 0, 1, row, row + 1, xpadding = 5)274 table.attach(label, 0, 1, row, row + 1, xpadding = 5)
275 table.attach(self.wb_combos[text], 1, 2, row, row + 1 )275 table.attach(self.wb_combos[text], 1, 2, row, row + 1 )
276276
277
278 self.gb_close_popup_on_click_checkbutton_names = ['windowbutton_close_popup_on_left_click',
279 'windowbutton_close_popup_on_shift_and_left_click',
280 'windowbutton_close_popup_on_middle_click',
281 'windowbutton_close_popup_on_shift_and_middle_click',
282 'windowbutton_close_popup_on_right_click',
283 'windowbutton_close_popup_on_shift_and_right_click',
284 'windowbutton_close_popup_on_scroll_up',
285 'windowbutton_close_popup_on_scroll_down']
286 self.gb_close_popup_on_click_checkbutton = {}
287
288 for i in range(len(self.gb_close_popup_on_click_checkbutton_names)):
289 name = self.gb_close_popup_on_click_checkbutton_names[i]
290 self.gb_close_popup_on_click_checkbutton[name] = gtk.CheckButton('Close popup on click')
291
292 self.gb_close_popup_on_click_checkbutton[name].connect('toggled', self.checkbutton_toggled, name)
293 table.attach(self.gb_close_popup_on_click_checkbutton[name], 2, 3, i, i + 1, xpadding = 5 )
294
277 hbox.pack_start(table, False)295 hbox.pack_start(table, False)
278 frame.add(hbox)296 frame.add(hbox)
279 windowbutton_box.pack_start(frame, False, padding=5)297 windowbutton_box.pack_start(frame, False, padding=5)
@@ -385,6 +403,11 @@
385 'no_popup_for_one_window')403 'no_popup_for_one_window')
386 popup_box.pack_start(self.no_popup_cb, False, padding=5)404 popup_box.pack_start(self.no_popup_cb, False, padding=5)
387 405
406 self.close_popup_on_click_cb = gtk.CheckButton('Close popup on any mouse click outside of focus (instead of when out of focus)')
407 self.close_popup_on_click_cb.connect('toggled', self.checkbutton_toggled, 'close_popup_on_click')
408 popup_box.pack_start(self.close_popup_on_click_cb, False, padding=5)
409
410
388 # Alignment411 # Alignment
389 vbox = gtk.VBox()412 vbox = gtk.VBox()
390 label1 = gtk.Label("<b><big>%s</big></b>"%_("Alignment"))413 label1 = gtk.Label("<b><big>%s</big></b>"%_("Alignment"))
@@ -417,6 +440,17 @@
417 spinbox.pack_start(spinlabel, False)440 spinbox.pack_start(spinlabel, False)
418 spinbox.pack_start(self.delay_spin, False, padding=5)441 spinbox.pack_start(self.delay_spin, False, padding=5)
419 vbox.pack_start(spinbox, False)442 vbox.pack_start(spinbox, False)
443
444 spinbox = gtk.HBox()
445 spinlabel = gtk.Label("Second delay when already opened by first delay:")
446 spinlabel.set_alignment(0,0.5)
447 adj = gtk.Adjustment(0, 0, 2000, 1, 50)
448 self.delay_second_spin = gtk.SpinButton(adj, 0.5, 0)
449 adj.connect("value_changed", self.adjustment_changed, 'popup_delay_second')
450 spinbox.pack_start(spinlabel, False)
451 spinbox.pack_start(self.delay_second_spin, False, padding=5)
452 vbox.pack_start(spinbox, False)
453
420 popup_box.pack_start(vbox, False, padding=5)454 popup_box.pack_start(vbox, False, padding=5)
421 455
422 # Previews456 # Previews
@@ -440,7 +474,23 @@
440 vbox.pack_start(spinbox, False)474 vbox.pack_start(spinbox, False)
441 popup_box.pack_start(vbox, False, padding=5)475 popup_box.pack_start(vbox, False, padding=5)
442 476
443 477 # On group button action
478 vbox = gtk.VBox()
479 label2 = gtk.Label("<b>When group button is executed action:</b>")
480 label2.set_alignment(0,0.5)
481 label2.set_use_markup(True)
482 vbox.pack_start(label2,False)
483
484 self.disable_popup_on_gbbutton_click_cb = gtk.CheckButton('Disable popup delay if popup not opened')
485 self.disable_popup_on_gbbutton_click_cb.connect('toggled', self.checkbutton_toggled, 'disable_popup_on_groupbutton_click')
486 vbox.pack_start(self.disable_popup_on_gbbutton_click_cb, False)
487
488 self.close_popup_on_gbbutton_click_cb = gtk.CheckButton('Close popup if popup is opened (ignored on "show popup" action)')
489 self.close_popup_on_gbbutton_click_cb.connect('toggled', self.checkbutton_toggled, 'close_popup_on_groupbutton_click')
490 vbox.pack_start(self.close_popup_on_gbbutton_click_cb, False)
491
492 popup_box.pack_start(vbox, False, padding=5)
493
444 #--- Groupbutton page 494 #--- Groupbutton page
445 frame = gtk.Frame(_("Groupbutton actions"))495 frame = gtk.Frame(_("Groupbutton actions"))
446 frame.set_border_width(5)496 frame.set_border_width(5)
@@ -759,8 +809,11 @@
759809
760 # Popup810 # Popup
761 self.delay_spin.set_value(self.globals.settings['popup_delay'])811 self.delay_spin.set_value(self.globals.settings['popup_delay'])
762 self.no_popup_cb.set_active(812 self.delay_second_spin.set_value(self.globals.settings['popup_delay_second'])
763 self.globals.settings['no_popup_for_one_window'])813 self.no_popup_cb.set_active(self.globals.settings['no_popup_for_one_window'])
814 self.close_popup_on_click_cb.set_active(self.globals.settings['close_popup_on_click'])
815 self.disable_popup_on_gbbutton_click_cb.set_active(self.globals.settings['disable_popup_on_groupbutton_click'])
816 self.close_popup_on_gbbutton_click_cb.set_active(self.globals.settings['close_popup_on_groupbutton_click'])
764817
765 # Group button keys818 # Group button keys
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():
@@ -783,8 +836,10 @@
783 break836 break
784837
785 for name in self.gb_doubleclick_checkbutton_names:838 for name in self.gb_doubleclick_checkbutton_names:
786 self.gb_doubleclick_checkbutton[name].set_active(839 self.gb_doubleclick_checkbutton[name].set_active(self.globals.settings[name])
787 self.globals.settings[name])840
841 for name in self.gb_close_popup_on_click_checkbutton_names:
842 self.gb_close_popup_on_click_checkbutton[name].set_active(self.globals.settings[name])
788843
789 # Opacify844 # Opacify
790 self.opacify_cb.set_active(self.globals.settings['opacify'])845 self.opacify_cb.set_active(self.globals.settings['opacify'])
791846
=== modified file 'dockbarx/__init__.py' (properties changed: -x to +x)
=== modified file 'dockbarx/cairowidgets.py' (properties changed: -x to +x)
--- dockbarx/cairowidgets.py 2010-05-25 15:06:34 +0000
+++ dockbarx/cairowidgets.py 2010-07-05 16:50:40 +0000
@@ -209,4 +209,3 @@
209 ctx.set_source_rgba(0.0, 0.0, 0.0, alpha)209 ctx.set_source_rgba(0.0, 0.0, 0.0, alpha)
210 ctx.set_line_width(1)210 ctx.set_line_width(1)
211 ctx.stroke()211 ctx.stroke()
212
213212
=== modified file 'dockbarx/common.py' (properties changed: -x to +x)
--- dockbarx/common.py 2010-06-29 16:11:43 +0000
+++ dockbarx/common.py 2010-07-05 16:50:40 +0000
@@ -140,6 +140,7 @@
140 return False140 return False
141141
142142
143
143class Globals(gobject.GObject):144class Globals(gobject.GObject):
144 """ Globals is a signletron containing all the "global" variables of dockbarx.145 """ Globals is a signletron containing all the "global" variables of dockbarx.
145146
@@ -156,38 +157,37 @@
156 'gkey-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,())157 'gkey-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,())
157 }158 }
158159
159 DEFAULT_SETTINGS = {160 DEFAULT_SETTINGS = { "theme": "default",
160 "theme": "default",
161 "groupbutton_attention_notification_type": "red",161 "groupbutton_attention_notification_type": "red",
162 "workspace_behavior": "switch",162 "workspace_behavior": "switch",
163 "popup_delay": 250,163 "popup_delay": 250,
164 "popup_delay_second": 30,
165 "close_popup_on_click": False,
166 "disable_popup_on_groupbutton_click":False,
167 "close_popup_on_groupbutton_click":False,
164 "popup_align": "center",168 "popup_align": "center",
165 "no_popup_for_one_window": False,169 "no_popup_for_one_window": False,
166 "show_only_current_desktop": False,170 "show_only_current_desktop": False,
167 "preview": False,171 "preview": False,
172 "remember_previews": False,
168 "preview_size": 230,173 "preview_size": 230,
169174
170 "select_one_window": "select or minimize window",175 "select_one_window": "select or minimize window",
171 "select_multiple_windows": "select all",176 "select_multiple_windows": "select all",
172177
173 "opacify": False,178 "opacify": False,
174 "opacify_group": False,179 "opacify_group": False,
175 "opacify_alpha": 11,180 "opacify_alpha": 11,
176181
177 "separate_wine_apps": True,182 "separate_wine_apps": True,
178 "separate_ooo_apps": True,183 "separate_ooo_apps": True,
179184
180 "groupbutton_left_click_action": \185 "groupbutton_left_click_action":"select or minimize group",
181 "select or minimize group",186 "groupbutton_shift_and_left_click_action":"launch application",
182 "groupbutton_shift_and_left_click_action": \187 "groupbutton_middle_click_action":"close all windows",
183 "launch application",188 "groupbutton_shift_and_middle_click_action": "no action",
184 "groupbutton_middle_click_action": \
185 "close all windows",
186 "groupbutton_shift_and_middle_click_action": \
187 "no action",
188 "groupbutton_right_click_action": "show menu",189 "groupbutton_right_click_action": "show menu",
189 "groupbutton_shift_and_right_click_action": \190 "groupbutton_shift_and_right_click_action": "no action",
190 "no action",
191 "groupbutton_scroll_up": "select next window",191 "groupbutton_scroll_up": "select next window",
192 "groupbutton_scroll_down": "select previous window",192 "groupbutton_scroll_down": "select previous window",
193 "groupbutton_left_click_double": False,193 "groupbutton_left_click_double": False,
@@ -196,19 +196,22 @@
196 "groupbutton_shift_and_middle_click_double": False,196 "groupbutton_shift_and_middle_click_double": False,
197 "groupbutton_right_click_double": False,197 "groupbutton_right_click_double": False,
198 "groupbutton_shift_and_right_click_double": False,198 "groupbutton_shift_and_right_click_double": False,
199 "windowbutton_left_click_action": \199 "windowbutton_left_click_action":"select or minimize window",
200 "select or minimize window",200 "windowbutton_shift_and_left_click_action":"no action",
201 "windowbutton_shift_and_left_click_action": \201 "windowbutton_middle_click_action":"close window",
202 "no action",202 "windowbutton_shift_and_middle_click_action": "no action",
203 "windowbutton_middle_click_action": \
204 "close window",
205 "windowbutton_shift_and_middle_click_action": \
206 "no action",
207 "windowbutton_right_click_action": "show menu",203 "windowbutton_right_click_action": "show menu",
208 "windowbutton_shift_and_right_click_action": \204 "windowbutton_shift_and_right_click_action": "no action",
209 "no action",
210 "windowbutton_scroll_up": "shade window",205 "windowbutton_scroll_up": "shade window",
211 "windowbutton_scroll_down": "unshade window",206 "windowbutton_scroll_down": "unshade window",
207 "windowbutton_close_popup_on_left_click": False,
208 "windowbutton_close_popup_on_shift_and_left_click": False,
209 "windowbutton_close_popup_on_middle_click": False,
210 "windowbutton_close_popup_on_shift_and_middle_click": False,
211 "windowbutton_close_popup_on_right_click": False,
212 "windowbutton_close_popup_on_shift_and_right_click": False,
213 "windowbutton_close_popup_on_scroll_up": False,
214 "windowbutton_close_popup_on_scroll_down": False,
212215
213 "gkeys_select_next_group": False,216 "gkeys_select_next_group": False,
214 "gkeys_select_next_group_keystr": '<super>Tab',217 "gkeys_select_next_group_keystr": '<super>Tab',
@@ -257,6 +260,8 @@
257 self.orient = 'h'260 self.orient = 'h'
258 self.apps_by_id = {}261 self.apps_by_id = {}
259 self.theme_name = None262 self.theme_name = None
263 # link to current popup being shown
264 self.popup_showing = None
260265
261 # Get gconf settings266 # Get gconf settings
262 self.settings = self.DEFAULT_SETTINGS.copy()267 self.settings = self.DEFAULT_SETTINGS.copy()
263268
=== modified file 'dockbarx/dockbar.py' (properties changed: -x to +x)
--- dockbarx/dockbar.py 2010-07-03 14:15:35 +0000
+++ dockbarx/dockbar.py 2010-07-05 16:50:40 +0000
@@ -257,7 +257,7 @@
257 self.windows = None257 self.windows = None
258 self.container = None258 self.container = None
259 self.theme = None259 self.theme = None
260260 self.popup_showing = None
261 self.gkeys = {261 self.gkeys = {
262 'gkeys_select_next_group': None,262 'gkeys_select_next_group': None,
263 'gkeys_select_previous_group': None,263 'gkeys_select_previous_group': None,
@@ -453,9 +453,8 @@
453453
454454
455 def reset_all_surfaces(self):455 def reset_all_surfaces(self):
456 # Removes all saved pixbufs with active glow in groupbuttons456 # Removes all saved pixbufs with active glow in groupbuttons iconfactories.
457 # iconfactories. Use this def when the looks of active glow457 # Use this def when the looks of active glow has been changed.
458 # has been changed.
459 for group in self.groups.get_groups():458 for group in self.groups.get_groups():
460 group.icon_factory.reset_surfaces()459 group.icon_factory.reset_surfaces()
461460
@@ -475,6 +474,9 @@
475474
476 #### Applet events475 #### Applet events
477 def on_ppm_pref(self,event=None,data=None):476 def on_ppm_pref(self,event=None,data=None):
477 # close any popup list before
478 if self.popup_showing is not None:
479 self.popup_showing.hide_list()
478 # Starts the preference dialog480 # Starts the preference dialog
479 os.spawnlp(os.P_NOWAIT,'/usr/bin/dbx_preference.py',481 os.spawnlp(os.P_NOWAIT,'/usr/bin/dbx_preference.py',
480 '/usr/bin/dbx_preference.py')482 '/usr/bin/dbx_preference.py')
@@ -1013,8 +1015,7 @@
1013 entry = combobox.get_child()1015 entry = combobox.get_child()
1014 if identifier:1016 if identifier:
1015 entry.set_text(identifier)1017 entry.set_text(identifier)
1016 # Fill the popdown list with the names of all class1018 # Fill the popdown list with the names of all class names of buttons that hasn't got a launcher already
1017 # names of buttons that hasn't got a launcher already
1018 for name in self.groups.get_non_launcher_names():1019 for name in self.groups.get_non_launcher_names():
1019 combobox.append_text(name)1020 combobox.append_text(name)
1020 entry = combobox.get_child()1021 entry = combobox.get_child()
@@ -1211,4 +1212,4 @@
1211 gr.action_select_next_with_popup(previous=previous)1212 gr.action_select_next_with_popup(previous=previous)
12121213
1213 def gkey_select_previous_window_in_group(self):1214 def gkey_select_previous_window_in_group(self):
1214 self.gkey_select_next_window_in_group(previous=True)
1215\ No newline at end of file1215\ No newline at end of file
1216 self.gkey_select_next_window_in_group(previous=True)
12161217
=== modified file 'dockbarx/groupbutton.py' (properties changed: -x to +x)
--- dockbarx/groupbutton.py 2010-06-22 11:05:20 +0000
+++ dockbarx/groupbutton.py 2010-07-05 16:50:40 +0000
@@ -112,12 +112,14 @@
112 uri = uri.replace("%20","\ ")112 uri = uri.replace("%20","\ ")
113 uri = unquote(uri)113 uri = unquote(uri)
114 self.execute("%s %s"%(self.desktop_entry.getExec(), uri))114 self.execute("%s %s"%(self.desktop_entry.getExec(), uri))
115115 exe = exe[:exe.rfind('.')]
116 return exe
116117
117 def launch(self):118 def launch(self):
118 os.chdir(os.path.expanduser('~'))119 os.chdir(os.path.expanduser('~'))
119 if self.app:120 if self.app:
120 print "Executing", self.app.get_name()121 print "Executing", self.app.get_name()
122
121 return self.app.launch(None, None)123 return self.app.launch(None, None)
122 else:124 else:
123 print 'Executing %s'%self.desktop_entry.getExec()125 print 'Executing %s'%self.desktop_entry.getExec()
@@ -187,7 +189,6 @@
187 "Can't initiate Group button without identifier or launcher."189 "Can't initiate Group button without identifier or launcher."
188190
189191
190
191 # Variables192 # Variables
192 self.windows = {}193 self.windows = {}
193 self.minimized_windows_count = 0194 self.minimized_windows_count = 0
@@ -205,7 +206,7 @@
205 # Compiz sends out false mouse enter messages after button is pressed.206 # Compiz sends out false mouse enter messages after button is pressed.
206 # This works around that bug.207 # This works around that bug.
207 self.button_pressed = False208 self.button_pressed = False
208209 self.button_pressed_left = False
209 self.screen = wnck.screen_get_default()210 self.screen = wnck.screen_get_default()
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)
211212
@@ -219,13 +220,11 @@
219220
220221
221 # Button events222 # Button events
222 self.button.connect("enter-notify-event", self.on_button_mouse_enter)223 self.button.connect("enter-notify-event",self.on_button_mouse_enter)
223 self.button.connect("leave-notify-event", self.on_button_mouse_leave)224 self.button.connect("leave-notify-event",self.on_button_mouse_leave)
224 self.button.connect("button-release-event",225 self.button.connect("button-release-event",self.on_group_button_release_event)
225 self.on_group_button_release_event)226 self.button.connect("button-press-event",self.on_group_button_press_event)
226 self.button.connect("button-press-event",227 self.button.connect("scroll-event",self.on_group_button_scroll_event)
227 self.on_group_button_press_event)
228 self.button.connect("scroll-event", self.on_group_button_scroll_event)
229 self.button.connect("size-allocate", self.on_sizealloc)228 self.button.connect("size-allocate", self.on_sizealloc)
230 self.button_old_alloc = self.button.get_allocation()229 self.button_old_alloc = self.button.get_allocation()
231230
@@ -251,6 +250,16 @@
251 self.winlist = None250 self.winlist = None
252 self.on_show_previews_changed()251 self.on_show_previews_changed()
253252
253
254 self.popup = cairo_popup.window
255 self.popup_showing = False
256 self.popup_showing_by_delay = False
257 self.popup_just_closed_by_group_button = False
258 self.popup_delay_request_id = None
259 self.disable_popup_delay = False
260 self.delay_hide_list_request_id = None
261 self.delay_hide_list_done = False
262 self.popup.connect("leave-notify-event",self.on_popup_mouse_leave)
254 self.popup.add(self.popup_box)263 self.popup.add(self.popup_box)
255264
256265
@@ -322,7 +331,7 @@
322 return False331 return False
323332
324 #### State333 #### State
325 def update_popup_label(self, arg=None):334 def update_popup_label(self):
326 self.popup_label.set_text(335 self.popup_label.set_text(
327 "<span foreground='%s'>"%self.globals.colors['color2'] + \336 "<span foreground='%s'>"%self.globals.colors['color2'] + \
328 "<big><b>%s</b></big></span>"%self.name337 "<big><b>%s</b></big></span>"%self.name
@@ -369,15 +378,13 @@
369 else:378 else:
370 icon_effect = 0379 icon_effect = 0
371380
372 if self.mouse_over:381 if self.button_pressed_left is True:
373 mouse_over = IconFactory.MOUSE_OVER382 mouse_over = IconFactory.MOUSE_BUTTON_DOWN
374 elif self.button_drag_entered and not self.launcher_drag:383 elif self.mouse_over:
375 # Mouse over effect on other drag and drop
376 # than launcher dnd.
377 mouse_over = IconFactory.MOUSE_OVER384 mouse_over = IconFactory.MOUSE_OVER
378 else:385 else:
379 mouse_over = 0386 mouse_over = 0
380387
381 if self.launch_effect:388 if self.launch_effect:
382 launch_effect = IconFactory.LAUNCH_EFFECT389 launch_effect = IconFactory.LAUNCH_EFFECT
383 else:390 else:
@@ -702,19 +709,27 @@
702 709
703710
704 #### Show/hide list711 #### Show/hide list
705 def show_list_request(self):712 def show_list_request(self, request_by_popup_delay = False):
713 # ignore request if just closed popup
714 #if self.popup_just_closed_by_group_button is True:
715 if self.disable_popup_delay is True:
716 return False
706 # If mouse cursor is over the button, show popup window.717 # If mouse cursor is over the button, show popup window.
707 b_m_x,b_m_y = self.button.get_pointer()718 b_m_x,b_m_y = self.button.get_pointer()
708 b_r = self.button.get_allocation()719 b_r = self.button.get_allocation()
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) \
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):
711 and (b_m_y >= 0 and b_m_y < b_r.height) \722 self.show_list(request_by_popup_delay)
712 and not self.globals.right_menu_showing \
713 and not self.globals.dragging):
714 self.show_list()
715 return False723 return False
716724
717 def show_list(self):725 def show_list(self, request_by_popup_delay = False):
726 # set what kind of request we have
727 # tist must even if popup already showing so that it will be known what is last request
728 self.popup_showing_by_delay = request_by_popup_delay
729 # no need to do anything if alreay showing popup
730 if self.popup_showing is True:
731 return
732
718 # Move popup to it's right spot and show it.733 # Move popup to it's right spot and show it.
719 offset = 3734 offset = 3
720735
@@ -780,10 +795,17 @@
780 self.popup.move(x - w - offset,y)795 self.popup.move(x - w - offset,y)
781 else:796 else:
782 self.popup.move(x + b_alloc.width + offset,y)797 self.popup.move(x + b_alloc.width + offset,y)
798
783 self.popup.show()799 self.popup.show()
784 self.popup_showing = True800 self.popup_showing = True
785 self.on_set_icongeo_win()801 self.delay_hide_list_done = False
786 # The popup must be shown before the802
803 # close any others current popups
804 if self.globals.popup_showing is not None:
805 self.globals.popup_showing.hide_list()
806 # and define this one as current popup
807 self.globals.popup_showing = self
808 self.on_set_icongeo_win()
787 # preview can be set. Iterate gtk events.809 # preview can be set. Iterate gtk events.
788 while gtk.events_pending():810 while gtk.events_pending():
789 gtk.main_iteration(False)811 gtk.main_iteration(False)
@@ -811,73 +833,151 @@
811 previews)833 previews)
812 return False834 return False
813835
814 def hide_list_request(self):836 def delay_hide_list_request(self):
815 if self.popup.window == None:837 # remove hide_list_request id if was called by timeout
816 return838 self.delay_hide_list_request_id = None
817 # Checks if mouse cursor really isn't hovering the button839 self.delay_hide_list_done = True
818 # or the popup window anymore and hide the popup window840
819 # if so.841
820 p_m_x,p_m_y = self.popup.get_pointer()842 def hide_list_request(self):
821 p_w,p_h = self.popup.get_size()843
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
823 b_r = self.button.get_allocation()845 if self.popup.window == None or self.popup_showing is False:
824 r = 6 #radius for the rounded corner of popup window846 return
825847
826 # Make sure that the popup list isn't closed when848
827 # howering the gap between button and list.849 # verify validity of request based on close_popup_on_click settings
828 w,h = self.popup.get_size()850 if self.globals.settings['close_popup_on_click'] is not True:
829 p_x,p_y = self.popup.window.get_origin()851 # Checks if mouse cursor really isn't hovering the button
830 offset = 3852 # or the popup window anymore and hide the popup window
831 b_x,b_y = self.button.window.get_origin()853 # if so.
832 if self.globals.orient == 'h' \854 p_m_x,p_m_y = self.popup.get_pointer()
833 and b_m_x >= -8 and b_m_x <= (b_r.width+7):855 p_w,p_h = self.popup.get_size()
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()
835 or (p_y > b_y and b_m_y >= (b_r.height - 1) \857 b_r = self.button.get_allocation()
836 and b_m_y <= (b_r.height - 1 + offset)):858 r = 5 #radius for the rounded corner of popup window
837 gobject.timeout_add(50, self.hide_list_request)859
838 return860 # Make sure that the popup list isn't closed when
839 elif self.globals.orient == 'v' \861 # howering the gap between button and list.
840 and b_m_y >= -8 and b_m_y <= (b_r.height+7):862 w,h = self.popup.get_size()
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()
842 or (p_x > b_x and b_m_x >= (b_r.width - 1) \864 offset = 3
843 and b_m_x <= (b_r.width - 1 + offset)):865 b_x,b_y = self.button.window.get_origin()
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):
845 return867 if (p_y < b_y and b_m_y>=-offset and b_m_y<=0) \
846868 or (p_y > b_y and b_m_y>=(b_r.height-1) and b_m_y<=(b_r.height-1+offset)):
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
848 and p_m_y >= 0 and p_m_y < p_h:870 return
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):
850 # but check if it's still outside the rounded corners872 if (p_x < b_x and b_m_x>=-offset and b_m_x<=0) \
851 x = None873 or (p_x > b_x and b_m_x>=(b_r.width-1) and b_m_x<=(b_r.width-1+offset)):
852 y = None874 gobject.timeout_add(50, self.hide_list_request) # org value was 50
853 if p_m_x < r:875 return
854 x = r - p_m_x876
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))):
856 x = p_m_x - (p_w - r)878 # Mouse pointer is inside the "rectangle"
857 if p_m_y < r:879 # but check if it's still outside the rounded corners
858 y = r - p_m_y880 x = None
859 if (p_h - p_m_y) < r:881 y = None
860 y = p_m_y - (p_h - r)882 if p_m_x < r:
861 if x == None or y == None \883 x = r - p_m_x
862 or (x**2 + y**2) < (r-1)**2:884 if (p_w - p_m_x) < r:
863 # It's inside the rounded corners!885 x = p_m_x - (p_w - r)
864 return886 if p_m_y < r:
865 if b_m_x >= 0 and b_m_x < b_r.width \887 y = r - p_m_y
866 and b_m_y >= 0 and b_m_y < b_r.height:888 if (p_h - p_m_y) < r:
867 # Mouse pointer is over the group button.889 y = p_m_y - (p_h - r)
868 gobject.timeout_add(50, self.hide_list_request)890 if x == None or y == None \
869 # This timeout add is needed if mouse cursor leaves the891 or (x**2 + y**2) < (r-1)**2:
870 # screen following the screen edge.892 # It's inside the rounded corners!
871 return893 return
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))):
895 # Mouse pointer is over the group button.
896 gobject.timeout_add(50, self.hide_list_request) # org value was 50
897 # This timeout add is needed if mouse cursor leaves the
898 # screen following the screen edge.
899 return
900 else:
901 # if closing popup on mouse click
902 # then get all global click (desktop global) by getting pointer position and mask
903 display = gtk.gdk.display_get_default()
904 pos = display.get_pointer()
905 # if button modifiers are clicked then check if should realy close popup
906 if pos[3] == gtk.gdk.BUTTON1_MASK or pos[3] == gtk.gdk.BUTTON2_MASK \
907 or pos[3] == gtk.gdk.BUTTON3_MASK or pos[3] == gtk.gdk.BUTTON4_MASK \
908 or pos[3] == gtk.gdk.BUTTON5_MASK or (self.popup_showing_by_delay is True and self.delay_hide_list_done is True):
909 # close popup only if mouse position is not on list or on group button
910 p_m_x,p_m_y = self.popup.get_pointer()
911 p_w,p_h = self.popup.get_size()
912 b_m_x,b_m_y = self.button.get_pointer()
913 b_r = self.button.get_allocation()
914 r = 5 #radius for the rounded corner of popup window
915
916 # Make sure that the popup list isn't closed when
917 # howering the gap between button and list.
918 w,h = self.popup.get_size()
919 p_x,p_y = self.popup.window.get_origin()
920 offset = 3
921 b_x,b_y = self.button.window.get_origin()
922 if self.globals.orient == 'h' and b_m_x>=0 and b_m_x<=(b_r.width-1):
923 if (p_y < b_y and b_m_y>=-offset and b_m_y<=0) \
924 or (p_y > b_y and b_m_y>=(b_r.height-1) and b_m_y<=(b_r.height-1+offset)):
925 ##gobject.timeout_add(10, self.hide_list_request)
926 #print "waiting for new on click ..."
927 return
928 elif self.globals.orient == 'v' and b_m_y>=0 and b_m_y<=(b_r.height-1):
929 if (p_x < b_x and b_m_x>=-offset and b_m_x<=0) \
930 or (p_x > b_x and b_m_x>=(b_r.width-1) and b_m_x<=(b_r.width-1+offset)):
931 ##gobject.timeout_add(10, self.hide_list_request)
932 #print "waiting for new on click ..."
933 return
934
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))):
936 # Mouse pointer is inside the "rectangle"
937 # but check if it's still outside the rounded corners
938 x = None
939 y = None
940 if p_m_x < r:
941 x = r - p_m_x
942 if (p_w - p_m_x) < r:
943 x = p_m_x - (p_w - r)
944 if p_m_y < r:
945 y = r - p_m_y
946 if (p_h - p_m_y) < r:
947 y = p_m_y - (p_h - r)
948 if x == None or y == None \
949 or (x**2 + y**2) < (r-1)**2:
950 # It's inside the rounded corners!
951 return
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))):
953 # click inside of group button - just ignore this request
954 # new request will be made when mouse leaves group button so
955 # there is no need to call timout
956 ##gobject.timeout_add(10, self.hide_list_request)
957 return
958 else:
959 # no click yet - continute waiting
960 gobject.timeout_add(10, self.hide_list_request)
961 #print "waiting for click ", self.global_click_id, " ..."
962 return
963
872 self.hide_list()964 self.hide_list()
873 return965 return
874966
875 def hide_list(self):967 def hide_list(self):
968 print "request to close popup"
876 self.popup.hide()969 self.popup.hide()
877 self.popup_showing = False970 self.popup_showing = False
971 self.popup_showing_by_delay = False
972 self.globals.popup_showing = None
973 self.delay_hide_list_done = False
974
975 if self.mouse_over is True:
976 self.disable_popup_delay = True
977
878 self.on_set_icongeo_grp()978 self.on_set_icongeo_grp()
879 if self.globals.settings["preview"]:979 if self.globals.settings["preview"]:
880 # Remove preview icon to save memory980 # Remove previews to save memory.
881 for win in self.get_windows():981 for win in self.get_windows():
882 self.windows[win].clear_preview_image()982 self.windows[win].clear_preview_image()
883 gc.collect()983 gc.collect()
@@ -950,16 +1050,12 @@
950 if self.globals.opacity_values == None:1050 if self.globals.opacity_values == None:
951 return False1051 return False
952 try:1052 try:
953 compiz_call('obs/screen0/opacity_values','set', 1053 compiz_call('obs/screen0/opacity_values','set', self.globals.opacity_values)
954 self.globals.opacity_values)1054 compiz_call('obs/screen0/opacity_matches','set', self.globals.opacity_matches)
955 compiz_call('obs/screen0/opacity_matches','set',
956 self.globals.opacity_matches)
957 except:1055 except:
958 try:1056 try:
959 compiz_call('core/screen0/opacity_values','set', 1057 compiz_call('core/screen0/opacity_values','set', self.globals.opacity_values)
960 self.globals.opacity_values)1058 compiz_call('core/screen0/opacity_matches','set', self.globals.opacity_matches)
961 compiz_call('core/screen0/opacity_matches','set',
962 self.globals.opacity_matches)
963 except:1059 except:
964 print "Error: Couldn't set opacity back to normal."1060 print "Error: Couldn't set opacity back to normal."
965 self.globals.opacity_values = None1061 self.globals.opacity_values = None
@@ -1131,8 +1227,7 @@
1131 self.on_set_icongeo_grp()1227 self.on_set_icongeo_grp()
11321228
1133 def on_button_mouse_enter (self, widget, event):1229 def on_button_mouse_enter (self, widget, event):
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.
1135 # before a button_press event.
1136 if self.button_pressed :1231 if self.button_pressed :
1137 return1232 return
1138 self.mouse_over = True1233 self.mouse_over = True
@@ -1152,69 +1247,123 @@
1152 if self.globals.settings["popup_delay"]>0:1247 if self.globals.settings["popup_delay"]>0:
1153 self.on_set_icongeo_delay()1248 self.on_set_icongeo_delay()
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:
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
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:
1252 #make request with lower delay
1253 gobject.timeout_add(self.globals.settings['popup_delay_second'], self.show_list_request, True)
1254 elif self.globals.popup_showing is None:
1255 gobject.timeout_add(self.globals.settings['popup_delay'], self.show_list_request, True)
11571256
1158 def on_button_mouse_leave (self, widget, event):1257 def on_button_mouse_leave (self, widget, event):
1159 # In compiz there is a enter and 1258 # In compiz there is a enter and a leave event before a button_press event.
1160 # a leave event before a button_press event.
1161 self.button_pressed = False1259 self.button_pressed = False
1162 self.mouse_over = False1260 self.mouse_over = False
1261 self.disable_popup_delay = False
1262
1163 self.update_state()1263 self.update_state()
1164 self.hide_list_request()1264 if self.popup_showing is True:
1265 # also remove and previous hide_list_request's so that timout will be correct
1266 if self.delay_hide_list_request_id is not None:
1267 gobject.source_remove(self.delay_hide_list_request_id)
1268
1269 # clear delay hide_list request flag
1270 self.delay_hide_list_done = False
1271
1272 # request for popup list to hide
1273 # if closing popup on click then should delay request
1274 if self.popup_showing_by_delay is True and self.globals.settings['close_popup_on_click']:
1275
1276 # make request
1277 request_timeout = 600
1278 self.delay_hide_list_request_id = gobject.timeout_add(request_timeout,self.delay_hide_list_request)
1279
1280 self.hide_list_request()
1281
1282 elif self.popup_delay_request_id is not None:
1283 gobject.source_remove(self.popup_delay_request_id)
1284 self.popup_delay_request_id = None
1165 if self.popup.window == None:1285 if self.popup.window == None:
1166 # self.hide_list takes care of 'set-icongeo-grp' normally1286 # self.hide_list takes care of 'set-icongeo-grp' normally
1167 # but if no popup window exist its taken care of here.1287 # but if no popup window exist its taken care of here.
1168 self.on_set_icongeo_grp()1288 self.on_set_icongeo_grp()
1169 if self.globals.settings["opacify"] \1289 if self.globals.settings["opacify"] and self.globals.settings["opacify_group"]:
1170 and self.globals.settings["opacify_group"]:
1171 self.deopacify_request()1290 self.deopacify_request()
11721291
1173 def on_popup_mouse_leave (self,widget,event):1292 def on_popup_mouse_leave (self,widget,event):
1293 # request for popup list to hide
1294
1295 # remove any previous hide_list_request's o that timout will be correct
1296 if self.delay_hide_list_request_id is not None:
1297 gobject.source_remove(self.delay_hide_list_request_id)
1298
1299 # clear delay hide_list request flag
1300 self.delay_hide_list_done = False
1301
1302 # if closing popup on click then should delay request
1303 if self.popup_showing_by_delay is True and self.globals.settings['close_popup_on_click']:
1304 # make request
1305 request_timeout = 600
1306 self.delay_hide_list_request_id = gobject.timeout_add(request_timeout,self.delay_hide_list_request)
1307
1174 self.hide_list_request()1308 self.hide_list_request()
1309 return
11751310
1176 def on_group_button_scroll_event (self,widget,event):1311 def on_group_button_scroll_event (self,widget,event):
1312 disable_popup = True
1177 if event.direction == gtk.gdk.SCROLL_UP:1313 if event.direction == gtk.gdk.SCROLL_UP:
1178 action = self.globals.settings['groupbutton_scroll_up']1314 action = self.globals.settings['groupbutton_scroll_up']
1179 self.action_function_dict[action](self, widget, event)1315 self.action_function_dict[action](self, widget, event)
1180 elif event.direction == gtk.gdk.SCROLL_DOWN:1316 elif event.direction == gtk.gdk.SCROLL_DOWN:
1181 action = self.globals.settings['groupbutton_scroll_down']1317 action = self.globals.settings['groupbutton_scroll_down']
1182 self.action_function_dict[action](self, widget, event)1318 self.action_function_dict[action](self, widget, event)
1319 else:
1320 disable_popup = False
1321
1322 # disbale popup list to be shown by delay when mouse clicked and action executed
1323 if self.globals.settings['disable_popup_on_groupbutton_click'] is True:
1324 self.disable_popup_delay = disable_popup;
11831325
1184 def on_group_button_release_event(self, widget, event):1326 def on_group_button_release_event(self, widget, event):
1327 disable_popup = True
1328 self.button_pressed = False
1329 self.button_pressed_left = False
1330 self.update_state()
1331
1185 # Check that the mouse still is over the group button.1332 # Check that the mouse still is over the group button.
1186 b_m_x,b_m_y = self.button.get_pointer()1333 b_m_x,b_m_y = self.button.get_pointer()
1187 b_r = self.button.get_allocation()1334 b_r = self.button.get_allocation()
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:
1189 return1336 return
1190
1191 # If a drag and drop just finnished set self.draggin to false1337 # If a drag and drop just finnished set self.draggin to false
1192 # so that left clicking works normally again1338 # so that left clicking works normally again
1193 if event.button == 1 and self.globals.dragging:1339 if event.button == 1 and self.globals.dragging:
1194 self.globals.dragging = False1340 self.globals.dragging = False
1195 return1341 return
1342
11961343
1197 if not event.button in (1, 2, 3):1344 if event.button in (1, 2, 3):
1198 return1345 button = {1:'left', 2: 'middle', 3: 'right'}[event.button]
1199 button = {1:'left', 2: 'middle', 3: 'right'}[event.button]1346 if event.state & gtk.gdk.SHIFT_MASK:
1200 if event.state & gtk.gdk.SHIFT_MASK:1347 mod = 'shift_and_'
1201 mod = 'shift_and_'1348 else:
1349 mod = ''
1350 if not self.globals.settings[
1351 'groupbutton_%s%s_click_double'%(mod, button)]:
1352 # No double click required, go ahead and do the action.
1353 action = self.globals.settings[
1354 'groupbutton_%s%s_click_action'%(mod, button)]
1355 self.action_function_dict[action](self, widget, event)
1202 else:1356 else:
1203 mod = ''1357 disable_popup = False
1204 if not self.globals.settings[
1205 'groupbutton_%s%s_click_double'%(mod, button)]:
1206 # No double click required, go ahead and do the action.
1207 action = self.globals.settings[
1208 'groupbutton_%s%s_click_action'%(mod, button)]
1209 self.action_function_dict[action](self, widget, event)
12101358
1359 # disbale popup list to be shown by delay when mouse clicked and action executed
1360 if self.globals.settings['disable_popup_on_groupbutton_click'] is True:
1361 self.disable_popup_delay = disable_popup;
12111362
1212 def on_group_button_press_event(self,widget,event):1363 def on_group_button_press_event(self,widget,event):
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.
1214 # event before a button_press event.
1215 # self.button_pressed is used to stop functions started with1365 # self.button_pressed is used to stop functions started with
1216 # gobject.timeout_add from self.button_mouse_enter 1366 # gobject.timeout_add from self.button_mouse_enter or self.on_button_mouse_leave.
1217 # or self.on_button_mouse_leave.
1218 self.button_pressed = True1367 self.button_pressed = True
1219 gobject.timeout_add(600, self.set_button_pressed_false)1368 gobject.timeout_add(600, self.set_button_pressed_false)
12201369
@@ -1237,10 +1386,15 @@
1237 elif event.button == 1:1386 elif event.button == 1:
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.
1239 return False1388 return False
1389
1390 # disbale popup list to be shown by delay when mouse clicked and action executed
1391 if self.globals.settings['disable_popup_on_groupbutton_click'] is True:
1392 self.disable_popup_delay = True;
1393
1240 return True1394 return True
12411395
1242 def set_button_pressed_false(self):1396 def set_button_pressed_false(self):
1243 # Helper function to group_button_press_event.1397 # Helper function to group_button_press_event
1244 self.button_pressed = False1398 self.button_pressed = False
1245 return False1399 return False
12461400
@@ -1286,6 +1440,7 @@
12861440
1287 #### Actions1441 #### Actions
1288 def action_select(self, widget, event):1442 def action_select(self, widget, event):
1443 should_close_popup = self.globals.settings['close_popup_on_groupbutton_click']
1289 wins = self.get_windows()1444 wins = self.get_windows()
1290 if (self.launcher and not wins):1445 if (self.launcher and not wins):
1291 self.action_launch_application()1446 self.action_launch_application()
@@ -1293,29 +1448,24 @@
1293 elif len(wins) == 1:1448 elif len(wins) == 1:
1294 sow = self.globals.settings["select_one_window"]1449 sow = self.globals.settings["select_one_window"]
1295 if sow == "select window":1450 if sow == "select window":
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)
1297 elif sow == "select or minimize window":1452 elif sow == "select or minimize window":
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)
1299 event)
1300 # Multiple windows1454 # Multiple windows
1301 elif len(wins) > 1:1455 elif len(wins) > 1:
1302 smw = self.globals.settings["select_multiple_windows"]1456 smw = self.globals.settings["select_multiple_windows"]
1303 if smw == "select all":1457 if smw == "select all":
1304 self.action_select_or_minimize_group(widget, event, 1458 self.action_select_or_minimize_group(widget, event, minimize=False)
1305 minimize=False)
1306 elif smw == "select or minimize all":1459 elif smw == "select or minimize all":
1307 self.action_select_or_minimize_group(widget, event, 1460 self.action_select_or_minimize_group(widget, event, minimize=True)
1308 minimize=True)
1309 elif smw == "compiz scale":1461 elif smw == "compiz scale":
1310 umw = self.get_unminimized_windows()1462 umw = self.get_unminimized_windows()
1311 if len(umw) == 1:1463 if len(umw) == 1:
1312 sow = self.globals.settings["select_one_window"]1464 sow = self.globals.settings["select_one_window"]
1313 if sow == "select window":1465 if sow == "select window":
1314 self.windows[umw[0]].action_select_window(widget, 1466 self.windows[umw[0]].action_select_window(widget, event, close_popup = should_close_popup)
1315 event)
1316 elif sow == "select or minimize window":1467 elif sow == "select or minimize window":
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)
1318 widget, event)
1319 elif len(umw) == 0:1469 elif len(umw) == 0:
1320 self.action_select_or_minimize_group(widget, event)1470 self.action_select_or_minimize_group(widget, event)
1321 else:1471 else:
@@ -1326,7 +1476,7 @@
1326 self.action_select_popup(widget, event)1476 self.action_select_popup(widget, event)
13271477
1328 def action_select_popup(self, widget, event):1478 def action_select_popup(self, widget, event):
1329 if self.popup_showing is True:1479 if self.popup_showing is True and self.popup_showing_by_delay is not True:
1330 self.hide_list()1480 self.hide_list()
1331 else:1481 else:
1332 self.show_list()1482 self.show_list()
@@ -1348,6 +1498,9 @@
1348 wingr = False1498 wingr = False
1349 active_workspace = screen.get_active_workspace()1499 active_workspace = screen.get_active_workspace()
13501500
1501 # close popup if at least one window gets activated
1502 close_popup = False
1503
1351 # Check if there are any uminimized windows, unminimize1504 # Check if there are any uminimized windows, unminimize
1352 # them (unless they are on another workspace and work-1505 # them (unless they are on another workspace and work-
1353 # space behavior is somehting other than move) and1506 # space behavior is somehting other than move) and
@@ -1358,7 +1511,7 @@
1358 if win.is_minimized():1511 if win.is_minimized():
1359 ignored = False1512 ignored = False
1360 if not win.is_pinned() and win.get_workspace() != None \1513 if not win.is_pinned() and win.get_workspace() != None \
1361 and screen.get_active_workspace() != win.get_workspace():1514 and screen.get_active_workspace() != win.get_workspace():
1362 if mode == 'move':1515 if mode == 'move':
1363 ws = screen.get_active_workspace()1516 ws = screen.get_active_workspace()
1364 win.move_to_workspace(ws)1517 win.move_to_workspace(ws)
@@ -1375,7 +1528,11 @@
1375 if not ignored:1528 if not ignored:
1376 win.unminimize(event.time)1529 win.unminimize(event.time)
1377 unminimized = True1530 unminimized = True
1531 close_popup = True
1378 if unminimized:1532 if unminimized:
1533 # before returing also close popup if at least one window got shown
1534 if close_popup is True and self.globals.settings['close_popup_on_groupbutton_click'] is True:
1535 self.hide_list()
1379 return1536 return
13801537
1381 # Make a list of the windows in group with the bottom most1538 # Make a list of the windows in group with the bottom most
@@ -1386,8 +1543,7 @@
1386 # topmost windows.1543 # topmost windows.
1387 for win in windows_stacked:1544 for win in windows_stacked:
1388 if (not win.is_skip_tasklist()) and (not win.is_minimized()) \1545 if (not win.is_skip_tasklist()) and (not win.is_minimized()) \
1389 and (win.get_window_type() in [wnck.WINDOW_NORMAL,1546 and (win.get_window_type() in [wnck.WINDOW_NORMAL,wnck.WINDOW_DIALOG]):
1390 wnck.WINDOW_DIALOG]):
1391 if win in self.windows:1547 if win in self.windows:
1392 ignored = False1548 ignored = False
1393 if not win.is_pinned() and win.get_workspace() != None \1549 if not win.is_pinned() and win.get_workspace() != None \
@@ -1420,9 +1576,8 @@
1420 grtop = False1576 grtop = False
14211577
1422 if not grp_win_stacked and mode == 'switch':1578 if not grp_win_stacked and mode == 'switch':
1423 # Put the windows in dictionaries according to workspace and 1579 # Put the windows in dictionaries according to workspace and viewport
1424 # viewport so we can compare which workspace and viewport that 1580 # so we can compare which workspace and viewport that has most windows.
1425 # has most windows.
1426 workspaces ={}1581 workspaces ={}
1427 for win in self.windows:1582 for win in self.windows:
1428 if win.get_workspace() == None:1583 if win.get_workspace() == None:
@@ -1457,8 +1612,8 @@
1457 grp_win_stacked = vp1612 grp_win_stacked = vp
1458 elif nr == max:1613 elif nr == max:
1459 # Check wether this workspace or previous workspace1614 # Check wether this workspace or previous workspace
1460 # with the same amount of windows has been 1615 # with the same amount of windows has been activated
1461 # activated later.1616 # later.
1462 for win in ignorelist:1617 for win in ignorelist:
1463 if win in grp_win_stacked:1618 if win in grp_win_stacked:
1464 break1619 break
@@ -1479,7 +1634,11 @@
1479 if win.is_minimized():1634 if win.is_minimized():
1480 win.unminimize(event.time)1635 win.unminimize(event.time)
1481 unminimized = True1636 unminimized = True
1637 close_popup = True
1482 if unminimized:1638 if unminimized:
1639 # before returing also close popup if at least one window got shown
1640 if close_popup is True and self.globals.settings['close_popup_on_groupbutton_click'] is True:
1641 self.hide_list()
1483 return1642 return
1484 ordered_list = []1643 ordered_list = []
1485 ignorelist.reverse() #Bottommost window fist again.1644 ignorelist.reverse() #Bottommost window fist again.
@@ -1491,9 +1650,15 @@
1491 if grtop and not moved and minimize:1650 if grtop and not moved and minimize:
1492 for win in grp_win_stacked:1651 for win in grp_win_stacked:
1493 self.windows[win].window.minimize()1652 self.windows[win].window.minimize()
1653 close_popup = False
1494 if not grtop:1654 if not grtop:
1495 for win in grp_win_stacked:1655 for win in grp_win_stacked:
1496 self.windows[win].window.activate(event.time)1656 self.windows[win].window.activate(event.time)
1657 close_popup = True
1658
1659 # before returing also close popup if at least one window got shown
1660 if close_popup is True and self.globals.settings['close_popup_on_groupbutton_click'] is True:
1661 self.hide_list()
14971662
1498 def action_select_only(self, widget, event):1663 def action_select_only(self, widget, event):
1499 self.action_select_or_minimize_group(widget, event, False)1664 self.action_select_or_minimize_group(widget, event, False)
@@ -1503,13 +1668,19 @@
1503 if len(wins) > 1:1668 if len(wins) > 1:
1504 self.action_compiz_scale_windows(widget, event)1669 self.action_compiz_scale_windows(widget, event)
1505 elif len(wins) == 1:1670 elif len(wins) == 1:
1506 self.windows[wins[0]].action_select_window(widget, event)1671 self.windows[wins[0]].action_select_window(widget, event, close_popup = True)
15071672
1508 def action_minimize_all_windows(self,widget=None, event=None):1673 def action_minimize_all_windows(self,widget=None, event=None):
1674 # no need to hide list - user can that way select any specific window when all minimized
1675 #self.hide_list()
1676
1509 for window in self.get_windows():1677 for window in self.get_windows():
1510 window.minimize()1678 window.minimize()
15111679
1512 def action_maximize_all_windows(self,widget=None, event=None):1680 def action_maximize_all_windows(self,widget=None, event=None):
1681 # should hide popup list first
1682 if self.globals.settings['close_popup_on_groupbutton_click'] is True:
1683 self.hide_list()
1513 try:1684 try:
1514 action_maximize = wnck.WINDOW_ACTION_MAXIMIZE1685 action_maximize = wnck.WINDOW_ACTION_MAXIMIZE
1515 except:1686 except:
@@ -1559,7 +1730,10 @@
1559 # Just a safety check1730 # Just a safety check
1560 if not win in self.windows:1731 if not win in self.windows:
1561 return1732 return
1733
1562 self.windows[win].action_select_window(widget, event)1734 self.windows[win].action_select_window(widget, event)
1735 # do not know if it is better to close popup or leave it open
1736 #self.windows[win].action_select_window(widget, event, close_popup = True)
1563 if previous:1737 if previous:
1564 self.nextlist.insert(0, win)1738 self.nextlist.insert(0, win)
1565 else:1739 else:
@@ -1578,6 +1752,8 @@
1578 self.hide_list_request)1752 self.hide_list_request)
15791753
1580 def action_close_all_windows(self, widget=None, event=None):1754 def action_close_all_windows(self, widget=None, event=None):
1755 # should hide popup list first
1756 self.hide_list()
1581 if event:1757 if event:
1582 t = event.time1758 t = event.time
1583 else:1759 else:
@@ -1586,6 +1762,9 @@
1586 window.close(t)1762 window.close(t)
15871763
1588 def action_launch_application(self, widget=None, event=None):1764 def action_launch_application(self, widget=None, event=None):
1765 # should hide popup list first
1766 if self.globals.settings['close_popup_on_groupbutton_click'] is True:
1767 self.hide_list()
1589 if self.lastlaunch != None \1768 if self.lastlaunch != None \
1590 and time() - self.lastlaunch < 2:1769 and time() - self.lastlaunch < 2:
1591 return1770 return
@@ -1599,11 +1778,9 @@
1599 self.launch_effect = True1778 self.launch_effect = True
1600 self.update_state()1779 self.update_state()
1601 if self.windows:1780 if self.windows:
1602 self.launch_effect_timeout = gobject.timeout_add(2000, 1781 self.launch_effect_timeout = gobject.timeout_add(2000, self.remove_launch_effect)
1603 self.remove_launch_effect)
1604 else:1782 else:
1605 self.launch_effect_timeout = gobject.timeout_add(10000, 1783 self.launch_effect_timeout = gobject.timeout_add(10000, self.remove_launch_effect)
1606 self.remove_launch_effect)
16071784
16081785
1609 def action_show_menu(self, widget, event):1786 def action_show_menu(self, widget, event):
@@ -1625,15 +1802,13 @@
1625 #Launch program item1802 #Launch program item
1626 launch_program_item = gtk.MenuItem(_('_Launch application'))1803 launch_program_item = gtk.MenuItem(_('_Launch application'))
1627 menu.append(launch_program_item)1804 menu.append(launch_program_item)
1628 launch_program_item.connect("activate", 1805 launch_program_item.connect("activate", self.action_launch_application)
1629 self.action_launch_application)
1630 launch_program_item.show()1806 launch_program_item.show()
1631 if self.launcher:1807 if self.launcher:
1632 #Remove launcher item1808 #Remove launcher item
1633 remove_launcher_item = gtk.MenuItem(_('Unpin application'))1809 remove_launcher_item = gtk.MenuItem(_('Unpin application'))
1634 menu.append(remove_launcher_item)1810 menu.append(remove_launcher_item)
1635 remove_launcher_item.connect("activate", 1811 remove_launcher_item.connect("activate", self.action_remove_launcher)
1636 self.action_remove_launcher)
1637 remove_launcher_item.show()1812 remove_launcher_item.show()
1638 #Edit identifier item1813 #Edit identifier item
1639 edit_identifier_item = gtk.MenuItem(_('Edit Identifier'))1814 edit_identifier_item = gtk.MenuItem(_('Edit Identifier'))
@@ -1683,7 +1858,6 @@
1683 sep = gtk.SeparatorMenuItem()1858 sep = gtk.SeparatorMenuItem()
1684 menu.append(sep)1859 menu.append(sep)
1685 sep.show()1860 sep.show()
1686 # Windows stuff
1687 win_nr = self.get_windows_count()1861 win_nr = self.get_windows_count()
1688 if win_nr:1862 if win_nr:
1689 if win_nr == 1:1863 if win_nr == 1:
@@ -1723,13 +1897,14 @@
1723 # Close all1897 # Close all
1724 close_all_windows_item = gtk.MenuItem('%s%s'%(_("_Close"), t))1898 close_all_windows_item = gtk.MenuItem('%s%s'%(_("_Close"), t))
1725 menu.append(close_all_windows_item)1899 menu.append(close_all_windows_item)
1726 close_all_windows_item.connect("activate", 1900 close_all_windows_item.connect("activate", self.action_close_all_windows)
1727 self.action_close_all_windows)
1728 close_all_windows_item.show()1901 close_all_windows_item.show()
1729 menu.popup(None, None, None, event.button, event.time)1902 menu.popup(None, None, None, event.button, event.time)
1730 self.globals.right_menu_showing = True1903 self.globals.right_menu_showing = True
17311904
1732 def action_remove_launcher(self, widget=None, event=None):1905 def action_remove_launcher(self, widget=None, event=None):
1906 # should hide popup list first
1907 self.hide_list()
1733 print 'Removing launcher ', self.identifier1908 print 'Removing launcher ', self.identifier
1734 if self.identifier:1909 if self.identifier:
1735 name = self.identifier1910 name = self.identifier
@@ -1756,7 +1931,7 @@
1756 if not self.class_group or not wins:1931 if not self.class_group or not wins:
1757 return1932 return
1758 if len(wins) == 1:1933 if len(wins) == 1:
1759 self.windows[wins[0]].action_select_window(widget, event)1934 self.windows[wins[0]].action_select_window(widget, event, close_popup = True)
1760 return1935 return
1761 if self.globals.settings['show_only_current_desktop']:1936 if self.globals.settings['show_only_current_desktop']:
1762 path = 'scale/allscreens/initiate_key'1937 path = 'scale/allscreens/initiate_key'
@@ -1769,15 +1944,20 @@
1769 return1944 return
1770 # A new button enter signal is sent when compiz is called,1945 # A new button enter signal is sent when compiz is called,
1771 # a delay is therefor needed.1946 # a delay is therefor needed.
1772 gobject.timeout_add(self.globals.settings['popup_delay'] + 200, 1947 if self.globals.settings['disable_popup_on_groupbutton_click'] is True:
1773 self.hide_list)1948 # there is no problem with aditional compiz call since popup list
1949 # is disabled on any click (self.disable_popup_delay)
1950 self.hide_list()
1951 else:
1952 gobject.timeout_add(settings['popup_delay'] + 200, self.hide_list)
1953
17741954
1775 def action_compiz_shift_windows(self, widget, event):1955 def action_compiz_shift_windows(self, widget, event):
1776 wins = self.get_unminimized_windows()1956 wins = self.get_unminimized_windows()
1777 if not self.class_group or not wins:1957 if not self.class_group or not wins:
1778 return1958 return
1779 if len(wins) == 1:1959 if len(wins) == 1:
1780 self.windows[wins[0]].action_select_window(widget, event)1960 self.windows[wins[0]].action_select_window(widget, event, close_popup = True)
1781 return1961 return
17821962
1783 if self.globals.settings['show_only_current_desktop']:1963 if self.globals.settings['show_only_current_desktop']:
@@ -1791,42 +1971,51 @@
1791 return1971 return
1792 # A new button enter signal is sent when compiz is called,1972 # A new button enter signal is sent when compiz is called,
1793 # a delay is therefor needed.1973 # a delay is therefor needed.
1794 gobject.timeout_add(self.globals.settings['popup_delay']+ 200, 1974 if self.globals.settings['disable_popup_on_groupbutton_click'] is True:
1795 self.hide_list)1975 # there is no problem with aditional compiz call since popup list
1976 # is disabled on any click (self.disable_popup_delay)
1977 self.hide_list()
1978 else:
1979 gobject.timeout_add(settings['popup_delay']+ 200, self.hide_list)
17961980
1797 def action_compiz_scale_all(self, widget, event):1981 def action_compiz_scale_all(self, widget, event):
1798 try:1982 try:
1799 compiz_call('scale/allscreens/initiate_key', 'activate',1983 compiz_call('scale/allscreens/initiate_key','activate','root', self.root_xid)
1800 'root', self.root_xid)
1801 except:1984 except:
1802 return1985 return
1803 # A new button enter signal is sent when compiz is called,1986 # A new button enter signal is sent when compiz is called,
1804 # a delay is therefor needed.1987 # a delay is therefor needed.
1805 gobject.timeout_add(self.globals.settings['popup_delay']+ 200, 1988 if self.globals.settings['disable_popup_on_groupbutton_click'] is True:
1806 self.hide_list)1989 # there is no problem with aditional compiz call since popup list
1990 # is disabled on any click (self.disable_popup_delay)
1991 self.hide_list()
1992 else:
1993 gobject.timeout_add(settings['popup_delay']+ 200, self.hide_list)
18071994
1808 def action_dbpref (self,widget=None, event=None):1995 def action_dbpref (self,widget=None, event=None):
1809 # Preferences dialog1996 # Preferences dialog
1810 self.emit('launch-preference')1997 self.emit('launch-preference')
18111998
1812 def action_none(self, widget = None, event = None):1999 def action_none(self, widget = None, event = None):
2000 # if there is no action then reenable popup list
2001 self.disable_popup_delay = False
1813 pass2002 pass
18142003
1815 action_function_dict = \
1816 ODict((
1817 ("select", action_select),
1818 ("close all windows", action_close_all_windows),
1819 ("minimize all windows", action_minimize_all_windows),
1820 ("maximize all windows", action_maximize_all_windows),
1821 ("launch application", action_launch_application),
1822 ("show menu", action_show_menu),
1823 ("remove launcher", action_remove_launcher),
1824 ("select next window", action_select_next),
1825 ("select previous window", action_select_previous),
1826 ("minimize all other groups", action_minimize_all_other_groups),
1827 ("compiz scale windows", action_compiz_scale_windows),
1828 ("compiz shift windows", action_compiz_shift_windows),
1829 ("compiz scale all", action_compiz_scale_all),
1830 ("show preference dialog", action_dbpref),
1831 ("no action", action_none)
1832 ))
1833\ No newline at end of file2004\ No newline at end of file
2005 action_function_dict = ODict((
2006 ("select", action_select),
2007 ("close all windows", action_close_all_windows),
2008 ("minimize all windows", action_minimize_all_windows),
2009 ("maximize all windows", action_maximize_all_windows),
2010 ("launch application", action_launch_application),
2011 ("show menu", action_show_menu),
2012 ("remove launcher", action_remove_launcher),
2013 ("select next window", action_select_next),
2014 ("select previous window", action_select_previous),
2015 ("minimize all other groups", action_minimize_all_other_groups),
2016 ("compiz scale windows", action_compiz_scale_windows),
2017 ("compiz shift windows", action_compiz_shift_windows),
2018 ("compiz scale all", action_compiz_scale_all),
2019 ("show preference dialog", action_dbpref),
2020 ("no action", action_none)
2021 ))
2022
18342023
=== modified file 'dockbarx/i18n.py' (properties changed: -x to +x)
=== modified file 'dockbarx/iconfactory.py' (properties changed: -x to +x)
--- dockbarx/iconfactory.py 2010-06-29 16:11:43 +0000
+++ dockbarx/iconfactory.py 2010-07-05 16:50:40 +0000
@@ -45,6 +45,7 @@
45 LAUNCHER = 1<<645 LAUNCHER = 1<<6
46 # Icon effects46 # Icon effects
47 MOUSE_OVER = 1<<747 MOUSE_OVER = 1<<7
48 MOUSE_BUTTON_DOWN = 1<<13
48 NEEDS_ATTENTION = 1<<849 NEEDS_ATTENTION = 1<<8
49 BLINK = 1<<950 BLINK = 1<<9
50 # ACTIVE_WINDOW51 # ACTIVE_WINDOW
@@ -56,6 +57,7 @@
56 'all_minimized':ALL_MINIMIZED,57 'all_minimized':ALL_MINIMIZED,
57 'launcher':LAUNCHER,58 'launcher':LAUNCHER,
58 'mouse_over':MOUSE_OVER,59 'mouse_over':MOUSE_OVER,
60 'mouse_button_down':MOUSE_BUTTON_DOWN,
59 'needs_attention':NEEDS_ATTENTION,61 'needs_attention':NEEDS_ATTENTION,
60 'blink':BLINK,62 'blink':BLINK,
61 'active':ACTIVE,63 'active':ACTIVE,
@@ -104,9 +106,6 @@
104106
105107
106 def set_size(self, size):108 def set_size(self, size):
107 if size <= 0:
108 # To avoid chrashes.
109 size = 15
110 self.size = size109 self.size = size
111 self.surfaces = {}110 self.surfaces = {}
112 self.average_color = None111 self.average_color = None
@@ -120,8 +119,7 @@
120119
121120
122 def surface_update(self, type = 0):121 def surface_update(self, type = 0):
123 # Checks if the requested pixbuf is already122 # Checks if the requested pixbuf is already drawn and returns it if it is.
124 # drawn and returns it if it is.
125 # Othervice the surface is drawn, saved and returned.123 # Othervice the surface is drawn, saved and returned.
126 self.win_nr = type & 15124 self.win_nr = type & 15
127 if self.win_nr > self.max_win_nr:125 if self.win_nr > self.max_win_nr:
@@ -445,8 +443,7 @@
445 def find_icon_pixbuf(self, size):443 def find_icon_pixbuf(self, size):
446 # Returns the icon pixbuf for the program. Uses the following metods:444 # Returns the icon pixbuf for the program. Uses the following metods:
447445
448 # 1) If it is a launcher, return the icon from the446 # 1) If it is a launcher, return the icon from the launcher's desktopfile
449 # launcher's desktopfile
450 # 2) Get the icon from the gio app447 # 2) Get the icon from the gio app
451 # 3) Check if the res_class fits an themed icon.448 # 3) Check if the res_class fits an themed icon.
452 # 4) Search in path after a icon matching reclass.449 # 4) Search in path after a icon matching reclass.
@@ -464,8 +461,7 @@
464 icon = self.app.get_icon()461 icon = self.app.get_icon()
465 if icon.__class__ == gio.FileIcon:462 if icon.__class__ == gio.FileIcon:
466 if icon.get_file().query_exists(None):463 if icon.get_file().query_exists(None):
467 pixbuf = self.icon_from_file_name(464 pixbuf = self.icon_from_file_name(icon.get_file().get_path(), size)
468 icon.get_file().get_path(), size)
469 if pixbuf != None:465 if pixbuf != None:
470 return pixbuf466 return pixbuf
471 elif icon.__class__ == gio.ThemedIcon:467 elif icon.__class__ == gio.ThemedIcon:
@@ -504,8 +500,7 @@
504 # If no pixbuf has been found (can only happen for an unlaunched500 # If no pixbuf has been found (can only happen for an unlaunched
505 # launcher), make an empty pixbuf and show a warning.501 # launcher), make an empty pixbuf and show a warning.
506 if self.icon_theme.has_icon('application-default-icon'):502 if self.icon_theme.has_icon('application-default-icon'):
507 pixbuf = self.icon_theme.load_icon('application-default-icon',503 pixbuf = self.icon_theme.load_icon('application-default-icon',size,0)
508 size, 0)
509 else:504 else:
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)
511 pixbuf.fill(0x00000000)506 pixbuf.fill(0x00000000)
@@ -529,8 +524,7 @@
529 def icon_from_file_name(self, icon_name, icon_size = -1):524 def icon_from_file_name(self, icon_name, icon_size = -1):
530 if os.path.isfile(icon_name):525 if os.path.isfile(icon_name):
531 try:526 try:
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)
533 icon_size)
534 except:528 except:
535 pass529 pass
536 return None530 return None
537531
=== modified file 'dockbarx/theme.py' (properties changed: -x to +x)
=== modified file 'dockbarx/windowbutton.py' (properties changed: -x to +x)
--- dockbarx/windowbutton.py 2010-06-22 11:15:41 +0000
+++ dockbarx/windowbutton.py 2010-07-05 16:50:40 +0000
@@ -78,22 +78,14 @@
7878
7979
80 #--- Events80 #--- Events
81 self.window_button.connect("enter-notify-event",81 self.window_button.connect("enter-notify-event",self.on_button_mouse_enter)
82 self.on_button_mouse_enter)82 self.window_button.connect("leave-notify-event",self.on_button_mouse_leave)
83 self.window_button.connect("leave-notify-event",83 self.window_button.connect("button-press-event",self.on_window_button_press_event)
84 self.on_button_mouse_leave)84 self.window_button.connect("button-release-event",self.on_window_button_release_event)
85 self.window_button.connect("button-press-event",85 self.window_button.connect("scroll-event",self.on_window_button_scroll_event)
86 self.on_window_button_press_event)86 self.state_changed_event = self.window.connect("state-changed",self.on_window_state_changed)
87 self.window_button.connect("button-release-event",87 self.icon_changed_event = self.window.connect("icon-changed",self.on_window_icon_changed)
88 self.on_window_button_release_event)88 self.name_changed_event = self.window.connect("name-changed",self.on_window_name_changed)
89 self.window_button.connect("scroll-event",
90 self.on_window_button_scroll_event)
91 self.state_changed_event = self.window.connect("state-changed",
92 self.on_window_state_changed)
93 self.icon_changed_event = self.window.connect("icon-changed",
94 self.on_window_icon_changed)
95 self.name_changed_event = self.window.connect("name-changed",
96 self.on_window_name_changed)
9789
98 #--- D'n'D90 #--- D'n'D
99 self.window_button.drag_dest_set(gtk.DEST_DEFAULT_HIGHLIGHT, [], 0)91 self.window_button.drag_dest_set(gtk.DEST_DEFAULT_HIGHLIGHT, [], 0)
@@ -103,6 +95,7 @@
103 self.dnd_select_window = None95 self.dnd_select_window = None
10496
10597
98
106 def set_button_active(self, mode):99 def set_button_active(self, mode):
107 self.is_active_window = mode100 self.is_active_window = mode
108 self.update_label_state()101 self.update_label_state()
@@ -280,22 +273,18 @@
280 # to this windowbutton transparent.273 # to this windowbutton transparent.
281 if self.globals.opacity_values == None:274 if self.globals.opacity_values == None:
282 try:275 try:
283 self.globals.opacity_values = compiz_call(276 self.dockbar.opacity_values = compiz_call('obs/screen0/opacity_values','get')
284 'obs/screen0/opacity_values','get')
285 except:277 except:
286 try:278 try:
287 self.globals.opacity_values = compiz_call(279 self.dockbar.opacity_values = compiz_call('core/screen0/opacity_values','get')
288 'core/screen0/opacity_values','get')
289 except:280 except:
290 return281 return
291 if self.globals.opacity_matches == None:282 if self.globals.opacity_matches == None:
292 try:283 try:
293 self.globals.opacity_matches = compiz_call(284 self.dockbar.opacity_matches = compiz_call('obs/screen0/opacity_matches','get')
294 'obs/screen0/opacity_matches','get')
295 except:285 except:
296 try:286 try:
297 self.globals.opacity_matches = compiz_call(287 self.dockbar.opacity_values = compiz_call('core/screen0/opacity_matches','get')
298 'core/screen0/opacity_matches','get')
299 except:288 except:
300 return289 return
301 self.globals.opacified = True290 self.globals.opacified = True
@@ -339,16 +328,12 @@
339 if self.globals.opacity_values == None:328 if self.globals.opacity_values == None:
340 return False329 return False
341 try:330 try:
342 compiz_call('obs/screen0/opacity_values','set', 331 compiz_call('obs/screen0/opacity_values','set', self.dockbar.opacity_values)
343 self.globals.opacity_values)332 compiz_call('obs/screen0/opacity_matches','set', self.dockbar.opacity_matches)
344 compiz_call('obs/screen0/opacity_matches','set',
345 self.globals.opacity_matches)
346 except:333 except:
347 try:334 try:
348 compiz_call('core/screen0/opacity_values','set', 335 compiz_call('core/screen0/opacity_values','set', self.dockbar.opacity_values)
349 self.globals.opacity_values)336 compiz_call('core/screen0/opacity_matches','set', self.dockbar.opacity_matches)
350 compiz_call('core/screen0/opacity_matches','set',
351 self.globals.opacity_matches)
352 except:337 except:
353 print "Error: Couldn't set opacity back to normal."338 print "Error: Couldn't set opacity back to normal."
354 self.globals.opacity_values = None339 self.globals.opacity_values = None
@@ -361,8 +346,7 @@
361 # Make sure that mouse cursor really has left the window button.346 # Make sure that mouse cursor really has left the window button.
362 b_m_x,b_m_y = self.window_button.get_pointer()347 b_m_x,b_m_y = self.window_button.get_pointer()
363 b_r = self.window_button.get_allocation()348 b_r = self.window_button.get_allocation()
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):
365 and b_m_y >= 0 and b_m_y < b_r.height:
366 return True350 return True
367 self.globals.opacified = False351 self.globals.opacified = False
368 self.opacified = False352 self.opacified = False
@@ -390,8 +374,7 @@
390374
391 #### Events375 #### Events
392 def on_button_mouse_enter(self, widget, event):376 def on_button_mouse_enter(self, widget, event):
393 # In compiz there is a enter and 377 # In compiz there is a enter and a leave event before a button_press event.
394 # a leave event before a button_press event.
395 # Keep that in mind when coding this def!378 # Keep that in mind when coding this def!
396 if self.button_pressed :379 if self.button_pressed :
397 return380 return
@@ -402,8 +385,7 @@
402 gobject.timeout_add(500, self.deopacify_request)385 gobject.timeout_add(500, self.deopacify_request)
403386
404 def on_button_mouse_leave(self, widget, event):387 def on_button_mouse_leave(self, widget, event):
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.
406 # event before a button_press event.
407 # Keep that in mind when coding this def!389 # Keep that in mind when coding this def!
408 self.button_pressed = False390 self.button_pressed = False
409 self.update_label_state(False)391 self.update_label_state(False)
@@ -411,11 +393,9 @@
411 self.deopacify_request()393 self.deopacify_request()
412394
413 def on_window_button_press_event(self, widget,event):395 def on_window_button_press_event(self, widget,event):
414 # In compiz there is a enter and a leave event before396 # In compiz there is a enter and a leave event before a button_press event.
415 # a button_press event.
416 # self.button_pressed is used to stop functions started with397 # self.button_pressed is used to stop functions started with
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.
418 # or self.on_button_mouse_leave.
419 self.button_pressed = True399 self.button_pressed = True
420 gobject.timeout_add(600, self.set_button_pressed_false)400 gobject.timeout_add(600, self.set_button_pressed_false)
421401
@@ -432,9 +412,13 @@
432 if event.direction == gtk.gdk.SCROLL_UP:412 if event.direction == gtk.gdk.SCROLL_UP:
433 action = self.globals.settings['windowbutton_scroll_up']413 action = self.globals.settings['windowbutton_scroll_up']
434 self.action_function_dict[action](self, widget, event)414 self.action_function_dict[action](self, widget, event)
415 if self.globals.settings['windowbutton_close_popup_on_scroll_up'] is True:
416 self.emit('popup-hide', None)
435 elif event.direction == gtk.gdk.SCROLL_DOWN:417 elif event.direction == gtk.gdk.SCROLL_DOWN:
436 action = self.globals.settings['windowbutton_scroll_down']418 action = self.globals.settings['windowbutton_scroll_down']
437 self.action_function_dict[action](self, widget, event)419 self.action_function_dict[action](self, widget, event)
420 if self.globals.settings['windowbutton_close_popup_on_scroll_down'] is True:
421 self.emit('popup-hide', None)
438422
439 def on_window_button_release_event(self, widget,event):423 def on_window_button_release_event(self, widget,event):
440 if self.globals.settings["opacify"]and self.opacified:424 if self.globals.settings["opacify"]and self.opacified:
@@ -442,26 +426,36 @@
442 self.opacified = False426 self.opacified = False
443 self.deopacify()427 self.deopacify()
444 if event.button == 1 and event.state & gtk.gdk.SHIFT_MASK :428 if event.button == 1 and event.state & gtk.gdk.SHIFT_MASK :
445 action = self.globals.settings[429 action = self.globals.settings['windowbutton_shift_and_left_click_action']
446 'windowbutton_shift_and_left_click_action']
447 self.action_function_dict[action](self, widget, event)430 self.action_function_dict[action](self, widget, event)
431 if self.globals.settings['windowbutton_close_popup_on_shift_and_left_click'] is True:
432 self.emit('popup-hide', None)
448 elif event.button == 1:433 elif event.button == 1:
449 action = self.globals.settings['windowbutton_left_click_action']434 action = self.globals.settings['windowbutton_left_click_action']
450 self.action_function_dict[action](self, widget, event)435 self.action_function_dict[action](self, widget, event)
436 if self.globals.settings['windowbutton_close_popup_on_left_click'] is True:
437 self.emit('popup-hide', None)
451 elif event.button == 2 and event.state & gtk.gdk.SHIFT_MASK:438 elif event.button == 2 and event.state & gtk.gdk.SHIFT_MASK:
452 action = self.globals.settings[439 action = self.globals.settings['windowbutton_shift_and_middle_click_action']
453 'windowbutton_shift_and_middle_click_action']
454 self.action_function_dict[action](self, widget,event)440 self.action_function_dict[action](self, widget,event)
441 if self.globals.settings['windowbutton_close_popup_on_shift_and_middle_click'] is True:
442 self.emit('popup-hide', None)
455 elif event.button == 2:443 elif event.button == 2:
456 action = self.globals.settings['windowbutton_middle_click_action']444 action = self.globals.settings['windowbutton_middle_click_action']
457 self.action_function_dict[action](self, widget,event)445 self.action_function_dict[action](self, widget,event)
446 if self.globals.settings['windowbutton_close_popup_on_middle_click'] is True:
447 self.emit('popup-hide', None)
458 elif event.button == 3 and event.state & gtk.gdk.SHIFT_MASK:448 elif event.button == 3 and event.state & gtk.gdk.SHIFT_MASK:
459 action = self.globals.settings[449 action = self.globals.settings['windowbutton_shift_and_right_click_action']
460 'windowbutton_shift_and_right_click_action']
461 self.action_function_dict[action](self, widget, event)450 self.action_function_dict[action](self, widget, event)
451 if self.globals.settings['windowbutton_close_popup_on_shift_and_right_click'] is True:
452 self.emit('popup-hide', None)
462 elif event.button == 3:453 elif event.button == 3:
463 action = self.globals.settings['windowbutton_right_click_action']454 action = self.globals.settings['windowbutton_right_click_action']
464 self.action_function_dict[action](self, widget, event)455 self.action_function_dict[action](self, widget, event)
456 if self.globals.settings['windowbutton_close_popup_on_right_click'] is True:
457 self.emit('popup-hide', None)
458
465459
466 #### Menu functions460 #### Menu functions
467 def menu_closed(self, menushell):461 def menu_closed(self, menushell):
@@ -475,8 +469,7 @@
475 self.window.minimize()469 self.window.minimize()
476470
477 #### Actions471 #### Actions
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):
479 event=None, minimize=True):
480 # The window is activated, unless it is already473 # The window is activated, unless it is already
481 # activated, then it's minimized. Minimized474 # activated, then it's minimized. Minimized
482 # windows are unminimized. The workspace475 # windows are unminimized. The workspace
@@ -491,21 +484,27 @@
491 self.window.get_workspace().activate(t)484 self.window.get_workspace().activate(t)
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()):
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()
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()))
495 win_y-(win_y%self.screen.get_height()))
496 # Hide popup since mouse movment won't488 # Hide popup since mouse movment won't
497 # be tracked during compiz move effect489 # be tracked during compiz move effect
498 # which means popup list can be left open.490 # which means popup list can be left open.
499 self.emit('popup-hide', 'viewport-change')491 #self.emit('popup-hide', 'viewport-change')
492 close_popup = True
500 if self.window.is_minimized():493 if self.window.is_minimized():
501 self.window.unminimize(t)494 self.window.unminimize(t)
502 elif self.window.is_active() and minimize:495 elif self.window.is_active() and minimize:
503 self.window.minimize()496 self.window.minimize()
497 close_popup = False
504 else:498 else:
505 self.window.activate(t)499 self.window.activate(t)
506500
507 def action_select_window(self, widget = None, event = None):501 # also close popup list unless if we just minimized window
508 self.action_select_or_minimize_window(widget, event, False)502 # but only if needed by caller or due to compiz
503 if close_popup is True:
504 self.emit('popup-hide', None)
505
506 def action_select_window(self, widget = None, event = None, close_popup = False):
507 self.action_select_or_minimize_window(widget, event, False, close_popup)
509508
510 def action_close_window(self, widget=None, event=None):509 def action_close_window(self, widget=None, event=None):
511 self.window.close(gtk.get_current_event_time())510 self.window.close(gtk.get_current_event_time())
@@ -570,8 +569,7 @@
570 pass569 pass
571570
572 action_function_dict = ODict((571 action_function_dict = ODict((
573 ('select or minimize window', 572 ('select or minimize window', action_select_or_minimize_window),
574 action_select_or_minimize_window),
575 ('select window', action_select_window),573 ('select window', action_select_window),
576 ('maximize window', action_maximize_window),574 ('maximize window', action_maximize_window),
577 ('close window', action_close_window),575 ('close window', action_close_window),
@@ -581,4 +579,3 @@
581 ('no action', action_none)579 ('no action', action_none)
582 ))580 ))
583581
584
585582
=== modified file 'dockbarx/zg.py' (properties changed: -x to +x)

Subscribers

People subscribed via source and target branches