[Xfce4-commits] [xfce/xfce4-panel] 03/73: Tasklist: Make middle-click action configurable.

noreply at xfce.org noreply at xfce.org
Sun Feb 26 16:33:44 CET 2017


This is an automated email from the git hooks/post-receive script.

andrzejr pushed a commit to branch master
in repository xfce/xfce4-panel.

commit 6860da2be74cab07343a9895fd31b138699d445d
Author: Nick Schermer <nick at xfce.org>
Date:   Mon Jul 29 18:59:38 2013 +0200

    Tasklist: Make middle-click action configurable.
    
    Allow the set different actions to middle-click:
    
    Nothing:
    Nothing happens.
    
    Close Window:
    Do i have to explain?
    
    Minimize Window:
    Only minimize the window, this also means button-1
    events never minimize, only activate. So you never
    get lost in minimized windows anymore.
    
    # Conflicts:
    #	plugins/tasklist/tasklist-widget.c
---
 plugins/tasklist/tasklist-dialog.glade | 293 +++++++++++++++++++++++----------
 plugins/tasklist/tasklist-widget.c     |  71 ++++----
 plugins/tasklist/tasklist-widget.h     |  12 ++
 plugins/tasklist/tasklist.c            |   4 +-
 4 files changed, 261 insertions(+), 119 deletions(-)

diff --git a/plugins/tasklist/tasklist-dialog.glade b/plugins/tasklist/tasklist-dialog.glade
index 8fa64c4..ec57311 100644
--- a/plugins/tasklist/tasklist-dialog.glade
+++ b/plugins/tasklist/tasklist-dialog.glade
@@ -1,41 +1,129 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <requires lib="gtk+" version="2.14"/>
+  <requires lib="gtk+" version="2.24"/>
   <!-- interface-requires libxfce4ui 0.0 -->
   <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkListStore" id="grouping-model">
+    <columns>
+      <!-- column-name title -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Never</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Always</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">When space is limited</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkListStore" id="sort-order-model">
+    <columns>
+      <!-- column-name title -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">Timestamp</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Group title and timestamp</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Window title</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">Group title and window title</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">None, allow drag-and-drop</col>
+      </row>
+    </data>
+  </object>
   <object class="XfceTitledDialog" id="dialog">
+    <property name="can_focus">False</property>
     <property name="title" translatable="yes">Window Buttons</property>
     <property name="icon_name">gtk-properties</property>
     <property name="type_hint">normal</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox2">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
+        <property name="can_focus">False</property>
         <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="close-button">
+                <property name="label">gtk-close</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="help-button">
+                <property name="label">gtk-help</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
         <child>
           <object class="GtkVBox" id="vbox1">
             <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <property name="border_width">6</property>
-            <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
               <object class="GtkFrame" id="frame3">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">none</property>
                 <child>
                   <object class="GtkAlignment" id="alignment3">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="left_padding">12</property>
                     <child>
                       <object class="GtkVBox" id="vbox3">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="border_width">6</property>
-                        <property name="orientation">vertical</property>
                         <property name="spacing">6</property>
                         <child>
                           <object class="GtkCheckButton" id="show-labels">
                             <property name="label" translatable="yes">Show button _labels</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
@@ -43,12 +131,15 @@
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkCheckButton" id="flat-buttons">
                             <property name="label" translatable="yes">Show _flat buttons</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
@@ -56,12 +147,15 @@
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkCheckButton" id="show-handle">
                             <property name="label" translatable="yes">Show _handle</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
@@ -69,28 +163,34 @@
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">2</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkHBox" id="hbox2">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="spacing">12</property>
                             <child>
                               <object class="GtkLabel" id="label5">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="label" translatable="yes">Sorting _order:</property>
                                 <property name="use_underline">True</property>
                                 <property name="mnemonic_widget">sort-order</property>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
+                                <property name="fill">True</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkComboBox" id="sort-order">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="model">sort-order-model</property>
                                 <child>
                                   <object class="GtkCellRendererText" id="cellrenderertext1"/>
@@ -101,11 +201,14 @@
                               </object>
                               <packing>
                                 <property name="expand">False</property>
+                                <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">3</property>
                           </packing>
                         </child>
@@ -116,6 +219,7 @@
                 <child type="label">
                   <object class="GtkLabel" id="label1">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="label" translatable="yes">Appearance</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
@@ -125,31 +229,36 @@
               </object>
               <packing>
                 <property name="expand">False</property>
+                <property name="fill">True</property>
                 <property name="position">0</property>
               </packing>
             </child>
             <child>
               <object class="GtkFrame" id="frame1">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">none</property>
                 <child>
                   <object class="GtkAlignment" id="alignment1">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="left_padding">12</property>
                     <child>
                       <object class="GtkVBox" id="vbox2">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="border_width">6</property>
-                        <property name="orientation">vertical</property>
                         <property name="spacing">6</property>
                         <child>
                           <object class="GtkHBox" id="hbox1">
                             <property name="visible">True</property>
+                            <property name="can_focus">False</property>
                             <property name="spacing">12</property>
                             <child>
                               <object class="GtkLabel" id="label4">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">Window _grouping:</property>
                                 <property name="use_underline">True</property>
@@ -157,12 +266,14 @@
                               </object>
                               <packing>
                                 <property name="expand">False</property>
+                                <property name="fill">True</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
                             <child>
                               <object class="GtkComboBox" id="grouping">
                                 <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <property name="model">grouping-model</property>
                                 <child>
                                   <object class="GtkCellRendererText" id="cellrenderertext2"/>
@@ -173,30 +284,66 @@
                               </object>
                               <packing>
                                 <property name="expand">False</property>
+                                <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkCheckButton" id="switch-workspace-on-unminimize">
-                            <property name="label" translatable="yes">Restore minimized windows to current _workspace</property>
+                          <object class="GtkHBox" id="hbox3">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="draw_indicator">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">12</property>
+                            <child>
+                              <object class="GtkLabel" id="label6">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Mi_ddle click action:</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">middle-click</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkComboBox" id="middle-click">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="model">middle-click-model</property>
+                                <child>
+                                  <object class="GtkCellRendererText" id="cellrenderertext3"/>
+                                  <attributes>
+                                    <attribute name="text">0</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkCheckButton" id="show-wireframes">
-                            <property name="label" translatable="yes">D_raw window frame when hovering a button</property>
+                          <object class="GtkCheckButton" id="switch-workspace-on-unminimize">
+                            <property name="label" translatable="yes">Restore minimized windows to current _workspace</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
@@ -204,12 +351,15 @@
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">2</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkCheckButton" id="window-scrolling">
-                            <property name="label" translatable="yes">_Switch windows using the mouse wheel</property>
+                          <object class="GtkCheckButton" id="show-wireframes">
+                            <property name="label" translatable="yes">D_raw window frame when hovering a button</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
@@ -217,12 +367,15 @@
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">3</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkCheckButton" id="middle-button-close">
-                            <property name="label" translatable="yes">_Close windows using middle mouse button</property>
+                          <object class="GtkCheckButton" id="window-scrolling">
+                            <property name="label" translatable="yes">_Switch windows using the mouse wheel</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
@@ -230,6 +383,8 @@
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">4</property>
                           </packing>
                         </child>
@@ -240,6 +395,7 @@
                 <child type="label">
                   <object class="GtkLabel" id="label3">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="label" translatable="yes">Behaviour</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
@@ -249,27 +405,31 @@
               </object>
               <packing>
                 <property name="expand">False</property>
+                <property name="fill">True</property>
                 <property name="position">1</property>
               </packing>
             </child>
             <child>
               <object class="GtkFrame" id="frame2">
                 <property name="visible">True</property>
+                <property name="can_focus">False</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">none</property>
                 <child>
                   <object class="GtkAlignment" id="alignment2">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="left_padding">12</property>
                     <child>
                       <object class="GtkVBox" id="vbox4">
                         <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="border_width">6</property>
-                        <property name="orientation">vertical</property>
                         <property name="spacing">6</property>
                         <child>
                           <object class="GtkCheckButton" id="include-all-workspaces">
                             <property name="label" translatable="yes">Show windows from _all workspaces or viewports</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
@@ -277,12 +437,15 @@
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkCheckButton" id="show-only-minimized">
-                            <property name="label" translatable="yes">Show only _minimized windows</property>
+                          <object class="GtkCheckButton" id="include-all-monitors">
+                            <property name="label" translatable="yes">Show windows from all mo_nitors</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
@@ -290,12 +453,15 @@
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkCheckButton" id="include-all-monitors">
-                            <property name="label" translatable="yes">Show windows from all mo_nitors</property>
+                          <object class="GtkCheckButton" id="show-only-minimized">
+                            <property name="label" translatable="yes">Show only _minimized windows</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="receives_default">False</property>
@@ -303,6 +469,8 @@
                             <property name="draw_indicator">True</property>
                           </object>
                           <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
                             <property name="position">1</property>
                           </packing>
                         </child>
@@ -313,6 +481,7 @@
                 <child type="label">
                   <object class="GtkLabel" id="label2">
                     <property name="visible">True</property>
+                    <property name="can_focus">False</property>
                     <property name="label" translatable="yes">Filtering</property>
                     <attributes>
                       <attribute name="weight" value="bold"/>
@@ -321,55 +490,18 @@
                 </child>
               </object>
               <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
                 <property name="position">2</property>
               </packing>
             </child>
           </object>
           <packing>
             <property name="expand">False</property>
+            <property name="fill">True</property>
             <property name="position">1</property>
           </packing>
         </child>
-        <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area2">
-            <property name="visible">True</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="close-button">
-                <property name="label">gtk-close</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="help-button">
-                <property name="label">gtk-help</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
-                <property name="secondary">True</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
       </object>
     </child>
     <action-widgets>
@@ -377,44 +509,27 @@
       <action-widget response="0">help-button</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkListStore" id="grouping-model">
+  <object class="GtkListStore" id="middle-click-model">
     <columns>
       <!-- column-name title -->
       <column type="gchararray"/>
     </columns>
     <data>
       <row>
-        <col id="0" translatable="yes">Never</col>
+        <col id="0" translatable="yes">Nothing</col>
       </row>
       <row>
-        <col id="0" translatable="yes">Always</col>
+        <col id="0" translatable="yes">Close Window</col>
       </row>
       <row>
-        <col id="0" translatable="yes">When space is limited</col>
+        <col id="0" translatable="yes">Minimize Window</col>
       </row>
     </data>
   </object>
-  <object class="GtkListStore" id="sort-order-model">
-    <columns>
-      <!-- column-name title -->
-      <column type="gchararray"/>
-    </columns>
-    <data>
-      <row>
-        <col id="0" translatable="yes">Timestamp</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Group title and timestamp</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Window title</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">Group title and window title</col>
-      </row>
-      <row>
-        <col id="0" translatable="yes">None, allow drag-and-drop</col>
-      </row>
-    </data>
+  <object class="GtkSizeGroup" id="sizegroup1">
+    <widgets>
+      <widget name="label4"/>
+      <widget name="label6"/>
+    </widgets>
   </object>
 </interface>
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index dfdc69a..3134657 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -96,7 +96,7 @@ enum
   PROP_SORT_ORDER,
   PROP_WINDOW_SCROLLING,
   PROP_INCLUDE_ALL_BLINKING,
-  PROP_MIDDLE_BUTTON_CLOSE
+  PROP_MIDDLE_CLICK
 };
 
 struct _XfceTasklistClass
@@ -161,8 +161,8 @@ struct _XfceTasklist
    * or only the active workspace */
   guint                 all_blinking : 1;
 
-  /* close window with the mouse middle button */
-  guint                 middle_button_close : 1;
+  /* action to preform when middle clicking */
+  XfceTasklistMClick    middle_click;
 
   /* whether we only show windows that are in the geometry of
    * the monitor the tasklist is on */
@@ -485,11 +485,13 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
                                                          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_class,
-                                   PROP_MIDDLE_BUTTON_CLOSE,
-                                   g_param_spec_boolean ("middle-button-close",
-                                                         NULL, NULL,
-                                                         FALSE,
-                                                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+                                   PROP_MIDDLE_CLICK,
+                                   g_param_spec_uint ("middle-click",
+                                                      NULL, NULL,
+                                                      XFCE_TASKLIST_MIDDLE_CLICK_MIN,
+                                                      XFCE_TASKLIST_MIDDLE_CLICK_MAX,
+                                                      XFCE_TASKLIST_MIDDLE_CLICK_DEFAULT,
+                                                      EXO_PARAM_READWRITE));
 
   gtk_widget_class_install_style_property (gtkwidget_class,
                                            g_param_spec_int ("max-button-length",
@@ -568,7 +570,7 @@ xfce_tasklist_init (XfceTasklist *tasklist)
   tasklist->all_monitors = TRUE;
   tasklist->window_scrolling = TRUE;
   tasklist->all_blinking = TRUE;
-  tasklist->middle_button_close = FALSE;
+  tasklist->middle_click = XFCE_TASKLIST_MIDDLE_CLICK_DEFAULT;
   xfce_tasklist_geometry_set_invalid (tasklist);
 #ifdef GDK_WINDOWING_X11
   tasklist->wireframe_window = 0;
@@ -659,8 +661,8 @@ xfce_tasklist_get_property (GObject    *object,
       g_value_set_boolean (value, tasklist->all_blinking);
       break;
 
-    case PROP_MIDDLE_BUTTON_CLOSE:
-      g_value_set_boolean (value, tasklist->middle_button_close);
+    case PROP_MIDDLE_CLICK:
+      g_value_set_uint (value, tasklist->middle_click);
       break;
 
     default:
@@ -737,8 +739,8 @@ xfce_tasklist_set_property (GObject      *object,
       tasklist->all_blinking = g_value_get_boolean (value);
       break;
 
-    case PROP_MIDDLE_BUTTON_CLOSE:
-      tasklist->middle_button_close = g_value_get_boolean (value);
+    case PROP_MIDDLE_CLICK:
+      tasklist->middle_click= g_value_get_uint (value);
       break;
 
     default:
@@ -2778,25 +2780,35 @@ xfce_tasklist_button_button_release_event (GtkWidget         *button,
   /* only respond to in-button events */
   if (event->type == GDK_BUTTON_RELEASE
       && !xfce_taskbar_is_locked (child->tasklist)
-      && event->button == 1
       && !(event->x == 0 && event->y == 0) /* 0,0 = outside the widget in Gtk */
       && event->x >= 0 && event->x < allocation.width
       && event->y >= 0 && event->y < allocation.height)
     {
-      xfce_tasklist_button_activate (child, event->time);
-    }
+      if (event->button == 1)
+        {
+          /* press the button */
+          xfce_tasklist_button_activate (child, event->time);
 
-  /* close the window on middle mouse button */
-  if (event->type == GDK_BUTTON_RELEASE
-      && !xfce_taskbar_is_locked (child->tasklist)
-      && event->button == 2
-      && child->tasklist->middle_button_close
-      && !(event->x == 0 && event->y == 0) /* 0,0 = outside the widget in Gtk */
-      && event->x >= 0 && event->x < allocation.width
-      && event->y >= 0 && event->y < allocation.height)
-    {
-      wnck_window_close (child->window, event->time);
-      return TRUE;
+          /* if the window is still active, don't toggle the button */
+          return wnck_window_is_active (child->window);
+        }
+      else if (event->button == 2)
+        {
+          switch (child->tasklist->middle_click)
+            {
+            case XFCE_TASKLIST_MIDDLE_CLICK_NOTHING:
+              break;
+
+            case XFCE_TASKLIST_MIDDLE_CLICK_CLOSE_WINDOW:
+              wnck_window_close (child->window, event->time);
+              return TRUE;
+
+            case XFCE_TASKLIST_MIDDLE_CLICK_MINIMIZE_WINDOW:
+              if (!wnck_window_is_minimized (child->window))
+                wnck_window_minimize (child->window);
+              return FALSE;
+            }
+        }
     }
 
   return FALSE;
@@ -2900,7 +2912,10 @@ xfce_tasklist_button_activate (XfceTasklistChild *child,
   if (wnck_window_is_active (child->window)
       || wnck_window_transient_is_most_recently_activated (child->window))
     {
-      wnck_window_minimize (child->window);
+      /* minimize does not work when this is assigned to the
+       * middle mouse button */
+      if (child->tasklist->middle_click != XFCE_TASKLIST_MIDDLE_CLICK_MINIMIZE_WINDOW)
+        wnck_window_minimize (child->window);
     }
   else
     {
diff --git a/plugins/tasklist/tasklist-widget.h b/plugins/tasklist/tasklist-widget.h
index 5b4fc01..d3321c8 100644
--- a/plugins/tasklist/tasklist-widget.h
+++ b/plugins/tasklist/tasklist-widget.h
@@ -27,6 +27,7 @@ typedef struct _XfceTasklistClass     XfceTasklistClass;
 typedef struct _XfceTasklist          XfceTasklist;
 typedef enum   _XfceTasklistGrouping  XfceTasklistGrouping;
 typedef enum   _XfceTasklistSortOrder XfceTasklistSortOrder;
+typedef enum   _XfceTasklistMClick    XfceTasklistMClick;
 
 #define XFCE_TYPE_TASKLIST            (xfce_tasklist_get_type ())
 #define XFCE_TASKLIST(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), XFCE_TYPE_TASKLIST, XfceTasklist))
@@ -61,6 +62,17 @@ enum _XfceTasklistSortOrder
   XFCE_TASKLIST_SORT_ORDER_DEFAULT = XFCE_TASKLIST_SORT_ORDER_GROUP_TIMESTAMP
 };
 
+enum _XfceTasklistMClick
+{
+  XFCE_TASKLIST_MIDDLE_CLICK_NOTHING, /* do nothing */
+  XFCE_TASKLIST_MIDDLE_CLICK_CLOSE_WINDOW, /* close the window */
+  XFCE_TASKLIST_MIDDLE_CLICK_MINIMIZE_WINDOW, /* minimize, never minimize with button 1 */
+
+  XFCE_TASKLIST_MIDDLE_CLICK_MIN = XFCE_TASKLIST_MIDDLE_CLICK_NOTHING,
+  XFCE_TASKLIST_MIDDLE_CLICK_MAX = XFCE_TASKLIST_MIDDLE_CLICK_MINIMIZE_WINDOW,
+  XFCE_TASKLIST_MIDDLE_CLICK_DEFAULT = XFCE_TASKLIST_MIDDLE_CLICK_NOTHING
+};
+
 
 
 GType xfce_tasklist_get_type                (void) G_GNUC_CONST;
diff --git a/plugins/tasklist/tasklist.c b/plugins/tasklist/tasklist.c
index c5ec1db..bc5d2b5 100644
--- a/plugins/tasklist/tasklist.c
+++ b/plugins/tasklist/tasklist.c
@@ -148,7 +148,7 @@ tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
     { "sort-order", G_TYPE_UINT },
     { "window-scrolling", G_TYPE_BOOLEAN },
     { "include-all-blinking", G_TYPE_BOOLEAN },
-    { "middle-button-close", G_TYPE_BOOLEAN },
+    { "middle-click", G_TYPE_UINT },
     { NULL }
   };
 
@@ -262,7 +262,7 @@ tasklist_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
   TASKLIST_DIALOG_BIND ("show-handle", "active")
   TASKLIST_DIALOG_BIND ("sort-order", "active")
   TASKLIST_DIALOG_BIND ("window-scrolling", "active")
-  TASKLIST_DIALOG_BIND ("middle-button-close", "active")
+  TASKLIST_DIALOG_BIND ("middle-click", "active")
 
 #ifndef GDK_WINDOWING_X11
   /* not functional in x11, so avoid confusion */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list