Hello community,

here is the log from the commit of package mate-applet-dock for 
openSUSE:Factory checked in at 2017-05-20 10:12:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/mate-applet-dock (Old)
 and      /work/SRC/openSUSE:Factory/.mate-applet-dock.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "mate-applet-dock"

Sat May 20 10:12:43 2017 rev:14 rq:494387 version:0.77

Changes:
--------
--- /work/SRC/openSUSE:Factory/mate-applet-dock/mate-applet-dock.changes        
2017-03-20 17:11:35.568671983 +0100
+++ /work/SRC/openSUSE:Factory/.mate-applet-dock.new/mate-applet-dock.changes   
2017-05-20 10:12:45.043619311 +0200
@@ -1,0 +2,30 @@
+Tue May  9 16:45:47 UTC 2017 - sor.ale...@meowr.ru
+
+- Update to version 0.77:
+  * Applications can be added to the dock by dragging them off
+    menu applets (Main Menu, Menu Bar, Advanced Menu, Brisk Menu)
+    and onto the applet (Gtk3 only).
+  * If data is dragged from an app onto another running app's icon
+    the new app will be made active, allowing the dragged data to
+    dropped onto it (Gtk3 only).
+  * Add keyboard shortcuts to select and acticate applications in
+    the dock:
+    + <Super>1-0 for the first 10 apps in the dock
+    + <Super><Alt>1-0 for apps 10-20 in the dock
+    For the 5th application, it would be necessary to hold down
+    the Super key (i.e. the Windows key) and press 5. For the 12th
+    application, it would be necessary to hold bown both the Super
+    key and the Alt key and press 2.
+    The effect of these shortcuts is as follows:
+    + If the application is not running, it will be started.
+    + If the application is running and only has a single window
+      open, the window will cycled between minimised and activated
+      states.
+    + If the application is running and has multiple windows open,
+      each keypress will activate and display each window in turn.
+  *  Update the About window to provide details of the new
+     drag and drop and keyboard shortcuut features.
+  * Fix a bug which prevented window and action lists from
+    appearing.
+
+-------------------------------------------------------------------

Old:
----
  mate-dock-applet-0.76.tar.gz

New:
----
  mate-dock-applet-0.77.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ mate-applet-dock.spec ++++++
--- /var/tmp/diff_new_pack.G8yZef/_old  2017-05-20 10:12:45.691527767 +0200
+++ /var/tmp/diff_new_pack.G8yZef/_new  2017-05-20 10:12:45.691527767 +0200
@@ -18,13 +18,13 @@
 
 %define _name   mate-dock-applet
 Name:           mate-applet-dock
-Version:        0.76
+Version:        0.77
 Release:        0
 Summary:        Dock applet for the MATE panel
 License:        GPL-2.0+
 Group:          System/GUI/Other
 Url:            https://github.com/robint99/mate-dock-applet
-Source:         
https://github.com/robint99/%{_name}/archive/%{version}.tar.gz#/%{_name}-%{version}.tar.gz
+Source:         
https://github.com/robint99/%{_name}/archive/V%{version}.tar.gz#/%{_name}-%{version}.tar.gz
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  fdupes
@@ -78,11 +78,6 @@
     rm -rf *.pyc *.pyo __pycache__/
     touch -c *.py
     %py3_compile .
-    if [[ "$(head -c2 "$py"; echo)" == "#!" ]]; then
-        chmod a+x "$py"
-    else
-        chmod a-x "$py"
-    fi
 done
 
 %post

++++++ mate-dock-applet-0.76.tar.gz -> mate-dock-applet-0.77.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mate-dock-applet-0.76/ChangeLog 
new/mate-dock-applet-0.77/ChangeLog
--- old/mate-dock-applet-0.76/ChangeLog 2017-01-25 11:53:42.000000000 +0100
+++ new/mate-dock-applet-0.77/ChangeLog 2017-03-21 09:47:20.000000000 +0100
@@ -1,3 +1,35 @@
+V0.77 Extended drag and support in Gtk3 version of the applet:
+            Apps can be added to the dock by dragging them off menu applets
+            (Main Menu, Menu Bar, Advanced Menu, Brisk Menu) and onto the
+            applet (Gtk3 only)
+            If data is dragged from an app onto another running app's icon
+            the new app will be made active, allowing the dragged data to
+            dropped onto it (Gtk3 only)
+
+       Added keyboard shortcuts to select and acticate apps in the dock:
+            <Super>1-0 for the first 10 apps in the dock
+            <Super><Alt>1-0 for apps 10-20 in the dock
+
+            For the 5th app, it would be necessary to hold down the Super key
+            (i.e. the Windows) key and press 5. For the 12th app, it would be 
necessary
+            to hold bown both the Super key and the Alt key and press 2.
+
+            The effect of these shortcuts is as follows:
+            If the app is not running, it will be started.
+            If the app is running and only has a single window open, the 
window will
+            cycled between minimised and activated states.
+            If the app is running and has multiple windows open, each keypress 
will
+            activate and display each window in turn.
+
+      Updated the About window to provide details of the new drag and drop and
+      keyboard shortcuut features.
+
+      Fixed a bug which prevented window and action lists from appearing
+
+      New dependencies - keybinder-0.0 (gir1.2-keybinder-0.0 (ubuntu) for gtk2)
+                         keybinder-3.0 (gir1.2-keybinder-3.0 (ubuntu) for gtk3)
+                         libkeybinder-3.0 (Arch)
+
 V0.76 Added support for startup notification when launching apps.
       Added new indicator type - a single solid bar. On Gtk3 this uses the 
active
       theme's highlight colour. This is not possible with Gtk2, therefore the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mate-dock-applet-0.76/configure.ac 
new/mate-dock-applet-0.77/configure.ac
--- old/mate-dock-applet-0.76/configure.ac      2017-01-25 11:53:42.000000000 
+0100
+++ new/mate-dock-applet-0.77/configure.ac      2017-03-21 09:47:20.000000000 
+0100
@@ -1,4 +1,4 @@
-AC_INIT([Dock Applet], [0.76])
+AC_INIT([Dock Applet], [0.77])
 
 AM_INIT_AUTOMAKE
 AM_PATH_PYTHON([3.0])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mate-dock-applet-0.76/src/dock.in 
new/mate-dock-applet-0.77/src/dock.in
--- old/mate-dock-applet-0.76/src/dock.in       2017-01-25 11:53:42.000000000 
+0100
+++ new/mate-dock-applet-0.77/src/dock.in       2017-03-21 09:47:20.000000000 
+0100
@@ -89,9 +89,9 @@
        operation.
 
     Required because:
-        applets (for some reason) do not receive drag-motion events
-        we need to track the mouse x,y so that we can rearrange dock icons
-        on the fly
+        we don't get drag-motion events when dragging app icons
+        within the applet and we need to track the mouse x,y so that
+        we can rearrange dock icons on the fly
 
     Instantiates a timer which periodically gets the root x,y position of
     the mouse and translates these to applet x,y coordinate
@@ -224,6 +224,52 @@
         return True
 
 
+class DragActivateTimer(object):
+    """ Timer used when something other than a .desktop file is dragged onto 
the
+        dock
+
+    Instantiates a timer which will wait for a short interval and then activate
+    a specified app's window. This will allow apps to drag data onto the dock,
+    activate an app's window and then drop the data there. The short delay 
between
+    the user dragging data onto the dock and the app activating provides a 
better
+    user experience ....
+
+    Attributes:
+        the_app : the app whose window is to be acticvated
+        timer_id = the id of the timer that is instantiated
+
+    """
+
+    def __init__(self, the_dock, the_app):
+        """Init for the DragActionTimer class.
+
+        Sets everything up by creating the timer and setting a reference to
+        the DockedApp to be activated
+
+        Arguments:
+            the_dock : the dock...
+            the_app  : the app to be activated
+
+        """
+
+        self.the_app = the_app
+        self.the_dock = the_dock
+        # wait .3 of a second ...
+        # tion 50 timakemes per second
+        self.timer_id = GObject.timeout_add(333, self.do_timer)
+
+    def do_timer(self):
+        """ Activate the app
+        """
+
+        if (self.the_app is not None) and (self.the_app.is_running()):
+                if not self.the_app.is_active:
+                    self.the_dock.minimize_or_restore_windows(self.the_app, 
None)
+
+        self.timer_id = 0
+        return False # we only run once...
+
+
 class Dock(object):
     """The main application dock class
 
@@ -288,7 +334,10 @@
             panel_y : the panel's y position on screen
             panel_size : the size of the panel
             applet_pos : the position of the applet(in pixels) in the panel
-            dm_timer : timer to monitor mouse movement during drag and drop
+            dm_timer : timer to monitor mouse movement during app icon drag 
and drop
+            da_timer : timer to provide a short delay before activating an app 
when
+                       data other than a .desktop file is dragged on the applet
+
     """
 
     def __init__(self, applet):
@@ -366,6 +415,7 @@
         self.applet_pos = 0
 
         self.dm_timer = None
+        self.da_timer = None
 
         # create an event handler so that we can react to changes e.g
         # the panel the applet is on, or it's position on the panel
@@ -892,11 +942,11 @@
                              self.df_shortcut_3),
                             ("df_shortcut_4_action", None,
                              "df_shortcut_4_action", None, 
"df_shortcut_4_action",
-                              self.df_shortcut_4),
-                             ("pin_action", Gtk.STOCK_ADD,
-                              "_Pin app to the dock", None, "Pin app to the 
dock",
-                              self.pin_app),
-                             ("unpin_action", Gtk.STOCK_REMOVE,
+                             self.df_shortcut_4),
+                            ("pin_action", Gtk.STOCK_ADD,
+                             "_Pin app to the dock", None, "Pin app to the 
dock",
+                             self.pin_app),
+                            ("unpin_action", Gtk.STOCK_REMOVE,
                               "_Unpin app from the dock", None, "Unpin app 
from the dock",
                               self.unpin_app),
                              ("move_up_action", Gtk.STOCK_GO_UP,
@@ -1509,6 +1559,44 @@
             self.show_or_hide_indicators()
             self.write_settings()
 
+    def add_app_to_dock(self, desktop_file):
+        """ Adds the app specified by a desktop file to the dock and pins it
+
+        If the app is already present in the dock, no action is taken
+
+        :param desktop_file: the .desktop_file of the app
+
+        """
+
+        for app in self.app_list:
+            if app.desktop_file == desktop_file:
+                return
+
+        dock_app = docked_app.DockedApp()
+        dock_app.desktop_file = desktop_file
+        dock_app.read_info_from_desktop_file()
+        dock_app.is_pinned = True
+
+        if build_gtk2:
+            dock_app.applet_win = self.applet.window
+        else:
+            dock_app.applet_win = self.applet.get_window()
+
+        dock_app.applet = self.applet
+
+        dock_app.applet_orient = self.applet.get_orient()
+        dock_app.set_indicator(self.indicator)
+        dock_app.set_multi_ind(self.multi_ind)
+        dock_app.set_active_bg(self.active_bg)
+
+        size = self.applet.get_size()
+        self.set_app_icon(dock_app, size)
+        self.app_list.append(dock_app)
+        self.add_app(dock_app)
+        self.show_or_hide_app_icons()
+        self.show_or_hide_indicators()
+        self.write_settings()
+
     def show_win(self, win_no):
         """
         Bring the specified window number of the right clicked app to the front
@@ -1530,7 +1618,6 @@
             # have to send 0 as the event time because we have no event time 
to send
             wnck_win.close(0)
 
-
     def icon_theme_changed(self, icontheme):
         """ Callback for when the Gtk icon theme changes
 
@@ -1809,10 +1896,10 @@
                 # if we don't have the .desktop file then things get a little
                 #  more complicated
                 elif app.has_wnck_app(wnck_app) or \
-                     ((app.wnck_class == dock_app.wnck_class or
-                       app.wm_class_name.upper() == 
dock_app.wm_class_name.upper() and
+                    ((app.wnck_class == dock_app.wnck_class or
+                      app.wm_class_name.upper() == 
dock_app.wm_class_name.upper() and
                        # test below is fix for 
https://bugs.launchpad.net/ubuntu-mate/+bug/1555324
-                       app.wm_class_name.strip() != "")):
+                      app.wm_class_name.strip() != "")):
                         in_dock = True
 
                 if in_dock is True:
@@ -2150,6 +2237,23 @@
             else:
                 self.box.attach(dock_app.drawing_area, pos, 0, 1, 1)
 
+    def get_app_by_pos(self, position):
+        """
+            Get the app at a specified position in the dock
+
+        :param self:
+        :param position: int - the position of the app in self.app_list
+
+        :return: a docked_app, or none if position exceeds the number of
+                 apps in the dock
+
+        """
+
+        if position < len(self.app_list):
+            return self.app_list[position]
+        else:
+            return None
+
     def create_box(self, orientation):
         """Create a vertical or horizontal (depending on the applet 
orientation)
            box to contain the docked apps areas.
@@ -2552,7 +2656,7 @@
         the action to perform (minimizing, moving workspace, activating)
         is decided as follows:
            if (the app's windows are all minimized) or
-           (the app s one or more unminimized window but is not the active app)
+           (the app has one or more unminimized window but is not the active 
app)
            then
                restore the app's last active window or all windows (based on
                the user's settings). If the active window is on a  different
@@ -2634,8 +2738,14 @@
             # rarely, the last active win does not end up as the active window
             # if we activate here, so instead a workaround which seems to do
             # the trick is use a timer as below
+            if event is None:
+                # use the current time if we have no event
+                event_time = Gtk.get_current_event_time()
+            else:
+                event_time = event.time
+
             GObject.timeout_add(20, win_activation_timer,
-                                [last_active_win, event.time])
+                                [last_active_win, event_time])
 
         else:
             # minimize all windows and do the last active window last of all
@@ -2691,11 +2801,12 @@
             return
         self.activate_window(win)
 
-    def do_window_scroll(self, scroll_dir, event_time):
+    def do_window_scroll(self, scroll_dir, event_time, the_app=None):
         """ Scroll to the next/previous window of the currently active app
 
         This function is called in response to the mouse scroll event on the
-        panel applet
+        panel applet and also when an applet keyboard shortcut (e.g. <Super>1)
+        is used
 
         Depending on the scroll direction, make the next or previous window of
         the current app active. Scrolling will wrap around in both directions
@@ -2713,6 +2824,8 @@
             scroll_dir : A GDK.ScrollDirection which indicates whether to go
                          forwards or backwards through the window list
             event_time : the time scroll event occurred
+            the_app    : will indicate the app whose windows are to be scrolled
+                         when a keyboard shortcut has been used.
         """
 
         # we're only interested in scroll up and down events....
@@ -2720,10 +2833,15 @@
            (scroll_dir != Gdk.ScrollDirection.DOWN):
             return
 
-        if self.app_with_mouse is not None:
-            app = self.app_with_mouse
+        if the_app is None:
+            # we've been called in response to a mouse scroll event, so we 
need to get
+            # the app under the mouse
+            if self.app_with_mouse is not None:
+                app = self.app_with_mouse
+            else:
+                return
         else:
-            return
+            app = the_app
 
         # if the app isn't running, there's nothing to do...
         if app.is_running() is False:
@@ -2798,6 +2916,21 @@
 
         self.dm_timer.drag_ended = True
 
+    def start_da_timer(self, app):
+        """
+            Use a timer to before activating an app
+
+        Args:
+            app : the app to activate
+        """
+
+        # first of all, stop any other timer da_timer that may be running
+        if (self.da_timer is not None) and (self.da_timer.timer_id != 0):
+            GObject.source_remove(self.da_timer.timer_id)
+
+        # create a new timer
+        self.da_timer = DragActivateTimer(self, app)
+
     def get_app_under_mouse(self):
         """ Get the docked which is currently under the mouse cursor
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mate-dock-applet-0.76/src/dock_about.in 
new/mate-dock-applet-0.77/src/dock_about.in
--- old/mate-dock-applet-0.76/src/dock_about.in 2017-01-25 11:53:42.000000000 
+0100
+++ new/mate-dock-applet-0.77/src/dock_about.in 2017-03-21 09:47:20.000000000 
+0100
@@ -218,6 +218,35 @@
         """
 
         the_iter = self.__hints_text_buf.get_end_iter()
+
+        if not build_gtk2:
+            self.__hints_text_buf.insert_with_tags(the_iter,
+                                               "Drag and drop data between 
applications\n",
+                                               self.__tag_hint_bold)
+            self.__hints_text_buf.insert_with_tags(the_iter, "\n""To easily 
drag and drop data from one application " +
+                                               "to another, drag the data from 
the first application onto the dock " +
+                                               "icon of the second 
application. The dock will activate the second " +
+                                               "application's window, allowing 
the data to be dragged onto it. " +
+                                               "Note: the second application 
must already be running.\n\n",
+                                               self.__tag_hint_normal)
+            self.__hints_text_buf.insert_with_tags(the_iter,
+                                               "Adding new applications to the 
dock\n",
+                                               self.__tag_hint_bold)
+            self.__hints_text_buf.insert_with_tags(the_iter, "\n""Applications 
can be dragged and dropped from any menu " +
+                                               "applet (i.e. the Main Menu, 
Menu Bar, Advanced Menu, or Brisk Menu) " +
+                                               "directly onto the dock.\n\n",
+                                               self.__tag_hint_normal)
+
+        self.__hints_text_buf.insert_with_tags(the_iter,
+                                               "Activating apps with keyboard 
shortcuts\n",
+                                               self.__tag_hint_bold)
+        self.__hints_text_buf.insert_with_tags(the_iter, "\n""Holding down the 
<Super> (i.e. Windows) and pressing " +
+                                               "a number key will activate an 
app in the dock. For example, "+
+                                               "pressing ""1"" will activate 
the first app, ""2"" the second etc. "+
+                                               "Pressing ""0"" will activate 
the tenth app. To activate apps 11 to 20, "+
+                                               "hold down the <Alt> key as 
well as <Super>.\n\n",
+                                               self.__tag_hint_normal)
+
         self.__hints_text_buf.insert_with_tags(the_iter,
                                               "Opening a new instance of a 
running application\n",
                                               self.__tag_hint_bold)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mate-dock-applet-0.76/src/dock_action_list.in 
new/mate-dock-applet-0.77/src/dock_action_list.in
--- old/mate-dock-applet-0.76/src/dock_action_list.in   2017-01-25 
11:53:42.000000000 +0100
+++ new/mate-dock-applet-0.77/src/dock_action_list.in   2017-03-21 
09:47:20.000000000 +0100
@@ -175,10 +175,10 @@
         fg_str = "#%.2x%.2x%.2x" % (r, g, b)
 
         # now set the treeview colours
-        self.__title_renderer.set_property("cell-background", self.__bg_str)
-        self.__title_renderer.set_property("foreground", self.__fg_str)
+        self.__title_renderer.set_property("cell-background", bg_str)
+        self.__title_renderer.set_property("foreground", fg_str)
 
-        self.__icon_renderer.set_property("cell-background", self.__bg_str)
+        self.__icon_renderer.set_property("cell-background", bg_str)
 
     def button_release(self, widget, event):
         """ Handler for the button release event
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mate-dock-applet-0.76/src/dock_applet.in 
new/mate-dock-applet-0.77/src/dock_applet.in
--- old/mate-dock-applet-0.76/src/dock_applet.in        2017-01-25 
11:53:42.000000000 +0100
+++ new/mate-dock-applet-0.77/src/dock_applet.in        2017-03-21 
09:47:20.000000000 +0100
@@ -40,9 +40,11 @@
 if build_gtk2:
     gi.require_version("Gtk", "2.0")
     gi.require_version("Wnck", "1.0")
+    gi.require_version("Keybinder", "0.0")
 else:
     gi.require_version("Gtk", "3.0")
     gi.require_version("Wnck", "3.0")
+    gi.require_version("Keybinder", "3.0")
 
 gi.require_version("MatePanelApplet", "4.0")
 
@@ -53,17 +55,37 @@
 from gi.repository import Gtk
 from gi.repository import MatePanelApplet
 from gi.repository import Gdk
+from gi.repository import Keybinder
 from gi.repository import Gio
 from gi.repository import GObject
 from gi.repository import Wnck
 
 import xdg.DesktopEntry as DesktopEntry
+from urllib.parse import urlparse
 
 import docked_app
 import dock
 
 from log_it import log_it as log_it
 
+drag_dropped = False   # nasty global var used to keep track of whether or not 
a drag-drop event has
+                       # occurred
+
+# define a list of keyboard shortcuts to be used to activate specific apps in 
the dock
+# '<Super>1' to '<Super>0' will correspond to apps 1 to 10
+# '<Super><Alt>1' to '<Super><Alt>9' will correspond to apps 11 to 20
+keyb_shortcuts = ["<Super>1", "<Super>2", "<Super>3", "<Super>4", "<Super>5",
+                  "<Super>6", "<Super>7", "<Super>8", "<Super>9", "<Super>0",
+                  "<Super><Alt>1", "<Super><Alt>2", "<Super><Alt>3", 
"<Super><Alt>4", "<Super><Alt>5",
+                  "<Super><Alt>6", "<Super><Alt>7", "<Super><Alt>8", 
"<Super><Alt>9", "<Super><Alt>0"]
+
+# additional shortcuts for the number pad - definitely don't work on my UK 
keyboards but included
+# anyway in case they work for other layouts
+keyb_shortcuts1 = ["<Super>KP_1", "<Super>KP_2", "<Super>KP_3", "<Super>KP_4", 
"<Super>KP_5",
+                  "<Super>KP_6", "<Super>KP_7", "<Super>KP_8", "<Super>KP_9", 
"<Super>KP_0",
+                  "<Super><Alt>KP_1", "<Super><Alt>KP_2", "<Super><Alt>KP_3", 
"<Super><Alt>KP_4", "<Super><Alt>KP_5",
+                  "<Super><Alt>KP_6", "<Super><Alt>KP_7", "<Super><Alt>KP_8", 
"<Super><Alt>KP_9", "<Super><Alt>KP_0"]
+
 
 def applet_button_press(widget, event, the_dock):
     """Button press event for the applet
@@ -133,10 +155,10 @@
                 app.start_app()
             else:
 
-                # if the app only has a single window activate it, otherwise
+                # if the app only has a single window minimize or restore it, 
otherwise
                 # allow the user to select a window from a list
                 if app.get_num_windows() == 1:
-                    the_dock.activate_first_window(app)
+                    the_dock.minimize_or_restore_windows(app, event)
                 else:
                     the_dock.do_window_selection(app)
 
@@ -352,14 +374,74 @@
             Stop the timer that monitors the mouse position
     """
 
-    Gtk.drag_finish(context, True, False, time)
-
-    the_dock.stop_drag_motion_timer()
-
     app = the_dock.get_dragee()
     if app is not None:
+        the_dock.stop_drag_motion_timer()
         app.set_dragee(False)
         app.queue_draw()
+        Gtk.drag_finish(context, True, False, time)
+    else:
+
+        # set the drag_dropped module level var so that the drag_data_received 
event knows
+        # the dnd needs to finish
+        global drag_dropped
+        drag_dropped = True
+
+        target = widget.drag_dest_find_target(context, None)
+        widget.drag_get_data(context, target, time)
+        return True
+
+
+def applet_drag_data_received(widget, drag_context, x, y, data, info, time, 
the_dock):
+    """ Called when data has been requested from an external source
+        during a drag drop operation
+
+    Examine the data - if it is a .desktop file and the app it relates to
+    is not already in the dock, add it. If the data isn't a .desktop file
+    and the app under the mouse cursor is running, activate it so that
+    the dragged data can be dropped there...
+
+    :param widget: the widget responsible for the event
+    :param drag_context: the dnd context
+    :param x: the x position of the mouse
+    :param y:  y the y position of the mouse
+    :param data: the dragged data
+    :param info:
+    :param time:  the time of the event
+    :param the_dock: the dock ....
+    """
+
+    # examine the data  -did we get any uris ?
+    uri_list = data.get_uris()
+    if (uri_list is not None) and (len(uri_list) > 0):
+        # when dragging .desktop files to the dock we only allow one to be 
added at
+        # a time. Therefore we're only interested in the first item in the list
+        uri = urlparse(uri_list[0])
+        if uri.scheme == "file":
+            # we're looking for a .desktop file
+            if (uri.path != "") and 
(os.path.split(uri.path)[1].endswith(".desktop")) and \
+               (os.path.exists(uri.path)):
+
+                # we've got a .desktop file, so if it has been dropped we may 
need
+                # to add it to the dock
+                global drag_dropped
+                if drag_dropped:
+                    # add the .desktop file to the dock if it is not already 
there,,,
+                    the_dock.add_app_to_dock(uri.path)
+
+                    # cancel the dnd
+                    Gtk.drag_finish(drag_context, True, False, time)
+                    drag_dropped = False
+                    return
+                else:
+                    # the dnd continues ....
+                    Gdk.drag_status(drag_context, Gdk.DragAction.COPY, time)
+                    return
+
+    # this is not a .desktop so we need to activate the app under the mouse
+    tgt_app = the_dock.get_app_under_mouse()
+    the_dock.start_da_timer(tgt_app)
+    Gdk.drag_status(drag_context, Gdk.DragAction.COPY, time)
 
 
 def applet_drag_end(widget, context, the_dock):
@@ -381,6 +463,76 @@
         app.queue_draw()
 
 
+def applet_drag_motion(widget, context, x, y, time, the_dock):
+    """ Handler for the drag-motion event
+
+    :param widget:  - the applet
+    :param context: - the dnd context
+    :param x:       - x coord of the mouse
+    :param y:       - y coord of the mouse
+    :param time:    - the time of the event
+    :param the_dock - the dock
+    :return:
+    """
+
+    # if the applet isn't dragging an app icon, we may need to examine
+    # the dragged data to see whay it contains....
+    app = the_dock.get_dragee()
+    if app is None:
+        # examine the dragged data so we can decide what to do...
+        tgts = context.list_targets()
+        for t in tgts:
+            if t.name() == "text/uri-list":
+                # if the data contains uris, we need to request the data to
+                # see if it contains a .desktop file
+                widget.drag_get_data(context, t, time)
+                return True
+
+        # if the dragged data is anything other than a uri, we just need to 
activate the app under
+        # the mouse...
+        tgt_app = the_dock.get_app_under_mouse()
+        the_dock.start_da_timer(tgt_app)
+        return True
+    else:
+        # continue the dnd...
+        Gdk.drag_status(context, Gdk.DragAction.COPY, time)
+
+    return True
+
+
+def applet_shortcut_handler(keystring, the_dock):
+    """ Handler for global keyboard shortcut presses
+
+    Start the app if it isn't already running
+
+    If it is already runnning cycle through its windows ...
+
+    :param keystring: the keystring which was pressed e.g. "<Super>4"
+    :param the_dock: the dock...
+    """
+    # get the position in the dock of the app we need to activate
+    if keystring in keyb_shortcuts:
+        app_no = keyb_shortcuts.index(keystring)
+    else:
+        # now look in the number pad shortcurts
+        print("looking in number pad shortcuts")
+        app_no = keyb_shortcuts1.index(keystring)
+
+    app = the_dock.get_app_by_pos(app_no)
+    if app is not None:
+        start_app = app.is_running() is False
+        if start_app:
+            app.start_app()
+        else:
+
+            # if the app only has a single window minimize or restore it
+            # otherwise scroll through all available windows
+            if app.get_num_windows() == 1:
+                the_dock.minimize_or_restore_windows(app, None)
+            else:
+                the_dock.do_window_scroll(Gdk.ScrollDirection.DOWN, 0, app)
+
+
 def applet_fill(applet):
     """
     Create the applet
@@ -396,6 +548,10 @@
     """
 
     os.chdir(os.path.expanduser("~"))
+
+    # allow us to set our keyboard shortcuts...
+    Keybinder.init()
+
     applet.set_events(applet.get_events() | Gdk.EventMask.BUTTON_PRESS_MASK
                                           | Gdk.EventMask.BUTTON_RELEASE_MASK
                                           | Gdk.EventMask.POINTER_MOTION_MASK
@@ -421,22 +577,38 @@
 
     if not build_gtk2:
         # set up drag and drop - gtk3 only
-        # NOTE: drag-motion events never seem to trigger on applets, which
-        # makes it difficult to tell where the mouse pointer is.....
+        # NOTE: we don't get drag-motion events when dragging app icons within 
the
+        # dock, making it difficult to tell where the mouse pointer is.....
         # To get around this, dock.py now contains a timer to monitor the
-        # mouse x.y during drag and drops, but if drag-motion events
-        # ever start working, the code from the dock.py timer can be moved
-        # to drag-motion event handler
-        applet.drag_source_set(Gdk.ModifierType.BUTTON1_MASK, None,
+        # mouse x.y during these sorts of drag and drops.
+        # drag-motion events do fire when dropping from other apps (e.g. caja, 
the
+        # and the drag-motion event is used in these cases
+
+        # we allow .desktop files to be dropped on the applet, so....
+        drag_tgts = [Gtk.TargetEntry.new("text/uri-list", 0, 0)]
+        applet.drag_source_set(Gdk.ModifierType.BUTTON1_MASK, drag_tgts,
                                Gdk.DragAction.MOVE)
-        applet.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.MOVE)
 
+        drag_tgts = [Gtk.TargetEntry.new("text/uri-list", 0, 0)]
+        applet.drag_dest_set(Gtk.DestDefaults.MOTION, None, 
Gdk.DragAction.COPY)
+        applet.drag_dest_add_image_targets()
         applet.drag_dest_add_text_targets()
-        applet.drag_source_add_text_targets()
+        applet.drag_dest_add_uri_targets()
+
         applet.connect_after("drag-begin", applet_drag_begin, the_dock)
         applet.connect("drag-data-get", applet_drag_data_get)
         applet.connect("drag-drop", applet_drag_drop, the_dock)
         applet.connect("drag-end", applet_drag_end, the_dock)
+        applet.connect("drag-motion", applet_drag_motion, the_dock)
+        applet.connect("drag-data-received", applet_drag_data_received, 
the_dock)
+
+    # set up keyboard shortcuts used to activate apps in the dock
+    for shortcut in keyb_shortcuts:
+        if not Keybinder.bind(shortcut, applet_shortcut_handler, the_dock):
+            log_it("could not bind shortcut %s" % shortcut)
+    for shortcut in keyb_shortcuts1:
+        if not Keybinder.bind(shortcut, applet_shortcut_handler, the_dock):
+            log_it("could not bind shortcut %s" % shortcut)
 
     applet.set_background_widget(applet)  # hack for panel transparency
 


Reply via email to