Skip to content

Commit 67105ea

Browse files
committed
Fix for #126 - applet adding extra space to the end of the panel
1 parent 6e91f3c commit 67105ea

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/dock.in

+6-2
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ class Dock(object):
423423
panel_x : the panel's x position on screen
424424
panel_y : the panel's y position on screen
425425
panel_size : the size of the panel
426+
panel_expand : whether or not the panel is set to expand
426427
applet_pos : the position of the applet(in pixels) in the panel
427428
dm_timer : timer to monitor mouse movement during app icon drag and drop
428429
da_timer : timer to provide a short delay before activating an app when
@@ -568,6 +569,7 @@ class Dock(object):
568569
self.panel_x = 0
569570
self.panel_y = 0
570571
self.panel_size = 0
572+
self.panel_expand = True
571573
self.panel_orient = "top"
572574
self.applet_pos = 0
573575

@@ -837,6 +839,7 @@ class Dock(object):
837839
self.panel_x = self.panel_settings.get_int("x")
838840
self.panel_y = self.panel_settings.get_int("y")
839841
self.panel_size = self.panel_settings.get_int("size")
842+
self.panel_expand = self.panel_settings.get_boolean("expand")
840843

841844
# if this is left or right oriented panel we need to account for the
842845
# height of any top panel so that minimise locations are correctly
@@ -909,7 +912,8 @@ class Dock(object):
909912
app minimise locations
910913
"""
911914

912-
if (key == "orientation") or (key == "size"):
915+
if key in ["orientation", "size", "expand", "x", "x-centered", "y", "y-centered",
916+
"x-right", "y-bottom"]:
913917
self.get_applet_panel_info()
914918
if not build_gtk2:
915919
self.set_dock_panel_size()
@@ -3301,7 +3305,7 @@ class Dock(object):
33013305

33023306
num_vis = self.get_total_num_visible_apps()
33033307
if num_vis > min_icons:
3304-
i = num_vis
3308+
i = num_vis - min_icons
33053309
size_hints = []
33063310
while i > 0:
33073311
size_hints.append(i * app_size)

src/dock_applet.in

+8-1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ def applet_button_press(widget, event, the_dock):
110110
the_dock.hide_win_list()
111111
the_dock.hide_act_list()
112112
elif event.button == 1:
113+
114+
if the_dock.panel_expand is not True:
115+
# prevent the panel acting on the button press that we got
116+
# e.g. so that dragging dock icons does not also start a drag of the panel
117+
GObject.signal_stop_emission_by_name(widget, "button_press_event")
118+
113119
dx, dy = the_dock.get_drag_coords()
114120
if (dx == -1) and (dy == -1):
115121
the_dock.set_drag_coords(event.x, event.y)
@@ -141,7 +147,6 @@ def applet_button_release(widget, event, the_dock):
141147
"""
142148

143149
if event.button == 1:
144-
145150
the_dock.clear_drag_coords()
146151

147152
# hide popups
@@ -611,6 +616,8 @@ def applet_fill(applet):
611616
applet.set_flags(MatePanelApplet.AppletFlags.EXPAND_MAJOR |
612617
MatePanelApplet.AppletFlags.EXPAND_MINOR |
613618
MatePanelApplet.AppletFlags.FLAGS_NONE)
619+
else:
620+
applet.set_flags(AppletFlags.FLAGS_NONE)
614621

615622
if build_gtk2:
616623
applet.add(the_dock.box)

0 commit comments

Comments
 (0)