Hello community,

here is the log from the commit of package libyui for openSUSE:Factory checked 
in at 2020-11-23 15:34:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libyui (Old)
 and      /work/SRC/openSUSE:Factory/.libyui.new.5913 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libyui"

Mon Nov 23 15:34:12 2020 rev:56 rq:849082 version:3.12.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/libyui/libyui.changes    2020-10-29 
09:21:21.926633633 +0100
+++ /work/SRC/openSUSE:Factory/.libyui.new.5913/libyui.changes  2020-11-23 
18:50:21.565360024 +0100
@@ -1,0 +2,7 @@
+Wed Nov 11 17:17:45 UTC 2020 - Stefan Hundhammer <[email protected]>
+
+- Higher priority for toplevel menu shortcuts (bsc#1175489)
+- Dropped support for openSUSE 13.2 (or earlier) builds in .spec file
+- 3.12.2
+
+-------------------------------------------------------------------

Old:
----
  libyui-3.12.1.tar.bz2

New:
----
  libyui-3.12.2.tar.bz2

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

Other differences:
------------------
++++++ libyui-doc.spec ++++++
--- /var/tmp/diff_new_pack.IFaJj9/_old  2020-11-23 18:50:22.109360575 +0100
+++ /var/tmp/diff_new_pack.IFaJj9/_new  2020-11-23 18:50:22.113360578 +0100
@@ -20,7 +20,7 @@
 %define so_version 14
 
 Name:           %{parent}-doc
-Version:        3.12.1
+Version:        3.12.2
 Release:        0
 Source:         %{parent}-%{version}.tar.bz2
 

++++++ libyui.spec ++++++
--- /var/tmp/diff_new_pack.IFaJj9/_old  2020-11-23 18:50:22.133360599 +0100
+++ /var/tmp/diff_new_pack.IFaJj9/_new  2020-11-23 18:50:22.137360603 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           libyui
-Version:        3.12.1
+Version:        3.12.2
 Release:        0
 Source:         %{name}-%{version}.tar.bz2
 
@@ -28,14 +28,10 @@
 # this uses debug build, do not use in production!
 %bcond_with coverage
 
-%if 0%{?suse_version} > 1325
-BuildRequires:  libboost_headers-devel
-BuildRequires:  libboost_test-devel
-%else
-BuildRequires:  boost-devel
-%endif
 BuildRequires:  cmake >= 2.8
 BuildRequires:  gcc-c++
+BuildRequires:  libboost_headers-devel
+BuildRequires:  libboost_test-devel
 BuildRequires:  pkg-config
 
 %if %{with coverage}

++++++ libyui-3.12.1.tar.bz2 -> libyui-3.12.2.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-3.12.1/VERSION.cmake 
new/libyui-3.12.2/VERSION.cmake
--- old/libyui-3.12.1/VERSION.cmake     2020-10-23 12:06:30.000000000 +0200
+++ new/libyui-3.12.2/VERSION.cmake     2020-11-17 13:07:43.000000000 +0100
@@ -1,6 +1,6 @@
 SET( VERSION_MAJOR "3")
 SET( VERSION_MINOR "12" )
-SET( VERSION_PATCH "1" )
+SET( VERSION_PATCH "2" )
 SET( VERSION 
"${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${GIT_SHA1_VERSION}" )
 
 ##### This is need for the libyui core, ONLY.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-3.12.1/package/libyui-doc.spec 
new/libyui-3.12.2/package/libyui-doc.spec
--- old/libyui-3.12.1/package/libyui-doc.spec   2020-10-23 12:06:30.000000000 
+0200
+++ new/libyui-3.12.2/package/libyui-doc.spec   2020-11-17 13:07:43.000000000 
+0100
@@ -20,7 +20,7 @@
 %define so_version 14
 
 Name:           %{parent}-doc
-Version:        3.12.1
+Version:        3.12.2
 Release:        0
 Source:         %{parent}-%{version}.tar.bz2
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-3.12.1/package/libyui.changes 
new/libyui-3.12.2/package/libyui.changes
--- old/libyui-3.12.1/package/libyui.changes    2020-10-23 12:06:30.000000000 
+0200
+++ new/libyui-3.12.2/package/libyui.changes    2020-11-17 13:07:43.000000000 
+0100
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Wed Nov 11 17:17:45 UTC 2020 - Stefan Hundhammer <[email protected]>
+
+- Higher priority for toplevel menu shortcuts (bsc#1175489)
+- Dropped support for openSUSE 13.2 (or earlier) builds in .spec file
+- 3.12.2
+
+-------------------------------------------------------------------
 Thu Oct 15 13:46:31 UTC 2020 - Stefan Hundhammer <[email protected]>
 
 - Added support for OpenItems property for (nested) tables (bsc#1176402)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-3.12.1/package/libyui.spec 
new/libyui-3.12.2/package/libyui.spec
--- old/libyui-3.12.1/package/libyui.spec       2020-10-23 12:06:30.000000000 
+0200
+++ new/libyui-3.12.2/package/libyui.spec       2020-11-17 13:07:43.000000000 
+0100
@@ -16,7 +16,7 @@
 #
 
 Name:           libyui
-Version:        3.12.1
+Version:        3.12.2
 Release:        0
 Source:         %{name}-%{version}.tar.bz2
 
@@ -27,12 +27,8 @@
 # this uses debug build, do not use in production!
 %bcond_with coverage
 
-%if 0%{?suse_version} > 1325
 BuildRequires:  libboost_headers-devel
 BuildRequires:  libboost_test-devel
-%else
-BuildRequires:  boost-devel
-%endif
 BuildRequires:  cmake >= 2.8
 BuildRequires:  gcc-c++
 BuildRequires:  pkg-config
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-3.12.1/src/YShortcut.cc 
new/libyui-3.12.2/src/YShortcut.cc
--- old/libyui-3.12.1/src/YShortcut.cc  2020-10-23 12:06:30.000000000 +0200
+++ new/libyui-3.12.2/src/YShortcut.cc  2020-11-17 13:07:43.000000000 +0100
@@ -32,6 +32,7 @@
 #include "YShortcut.h"
 #include "YPushButton.h"
 #include "YDumbTab.h"
+#include "YMenuBar.h"
 
 
 // Return the number of elements of an array of any type
@@ -146,7 +147,7 @@
 
     if ( newShortcut != YShortcut::None )
     {
-       char findme[] = { (char)tolower( newShortcut ), (char)toupper( 
newShortcut ), 0 };
+       char findme[] = { (char) tolower( newShortcut ), (char) toupper( 
newShortcut ), 0 };
        string::size_type pos = str.find_first_of( findme );
 
        if ( pos == string::npos )
@@ -268,7 +269,7 @@
        }
        else
        {
-           // A pathological case: The string ends with '& '.
+           // A pathological case: The string ends with '&'.
            // This is invalid anyway, but prevent endless loop even in this 
case.
            return string::npos;
        }
@@ -308,6 +309,16 @@
 
 
 
+
+YItemShortcut::YItemShortcut( YWidget * widget, YItem * item )
+    : YShortcut( widget )
+    , _item( item )
+{
+    YMenuBar * menuBar = dynamic_cast<YMenuBar *>( widget );
+    _isMenuItem = menuBar ? true : false;
+}
+
+
 string
 YItemShortcut::getShortcutString()
 {
@@ -325,7 +336,7 @@
 
     if ( newShortcut != YShortcut::None )
     {
-       char findme[] = { (char)tolower( newShortcut ), (char)toupper( 
newShortcut ), 0 };
+       char findme[] = { (char)tolower( newShortcut ), (char) toupper( 
newShortcut ), 0 };
        string::size_type pos = str.find_first_of( findme );
 
        if ( pos == string::npos )
@@ -352,3 +363,25 @@
     _shortcut = newShortcut;
 
 }
+
+
+
+
+std::ostream & operator<<( std::ostream & stream, const YShortcut * shortcut )
+{
+    if ( shortcut )
+    {
+        stream << shortcut->widgetClass();
+
+        if ( dynamic_cast<const YItemShortcut *>( shortcut ) )
+            stream << " item";
+
+        stream << " \"" << shortcut->debugLabel() << "\"";
+    }
+    else
+    {
+        stream << "<NULL YShortcut>";
+    }
+
+    return stream;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-3.12.1/src/YShortcut.h 
new/libyui-3.12.2/src/YShortcut.h
--- old/libyui-3.12.1/src/YShortcut.h   2020-10-23 12:06:30.000000000 +0200
+++ new/libyui-3.12.2/src/YShortcut.h   2020-11-17 13:07:43.000000000 +0100
@@ -26,16 +26,21 @@
 #ifndef YShortcut_h
 #define YShortcut_h
 
-#include "YWidget.h"
+#include <iosfwd>
 #include <string>
 #include <vector>
 
-class YItem;
+#include "YWidget.h"
+#include "YItem.h"
 
 
 /**
  * Helper class for shortcut management:
  * This class holds data about the shortcut for one single widget.
+ *
+ * Notice that there is also a derived class YItemShortcut for item-based
+ * widgets that may have multiple shortcuts like YDumbTab, YMenuBar,
+ * YItemSelector.
  **/
 class YShortcut
 {
@@ -80,6 +85,14 @@
     bool isWizardButton() const { return _isWizardButton; }
 
     /**
+     * Returns 'true' if this is a shortcut for a (toplevel) menu item.
+     *
+     * This default implementation always returns 'false'.
+     * Derived classes like YItemShortcut can choose to overwrite this.
+     **/
+    virtual bool isMenuItem() const { return false; }
+
+    /**
      * Returns the complete shortcut string (which may or may not contain "&"),
      * i.e. the value of the widget's shortcut property. For PushButtons, this
      * is the label on the button ( e.g., "&Details..." ), for other widgets
@@ -152,6 +165,11 @@
     bool hasValidShortcutChar();
 
     /**
+     * Label of this shortcut suitable for debugging
+     **/
+    virtual std::string debugLabel() const { return _widget->debugLabel(); }
+
+    /**
      * Static function: Returns the character used for marking keyboard
      * shortcuts.
      **/
@@ -216,6 +234,7 @@
     /// char or 0 (none found) or -1 (not initialized yet)
     /// @see preferred
     int                _preferred;
+
     /// char or 0 (none found) or -1 (not initialized yet)
     /// @see shortcut
     int                _shortcut;
@@ -223,6 +242,7 @@
     bool       _conflict;       ///< @see conflict
     bool       _isButton;       ///< @see isButton
     bool       _isWizardButton; ///< @see isWizardButton
+
     /// -1 means uninitialized
     /// @see distinctShortcutChars
     int                _distinctShortcutChars;
@@ -231,8 +251,13 @@
 
 
 /**
- * Special case for widgets that can have multiple shortcuts based on items
- * (like YDumbTab)
+ * Special case for item-based widgets that can have multiple shortcuts like
+ * YDumbTab, YMenuBar, YItemSelector. Each instance represents one of those
+ * items.
+ *
+ * For YMenuBar, only the toplevel items are handled here since only their
+ * shortcuts need to be unique within the dialog. Within each menu, shortcut
+ * conflicts are resolved separately in YMenuWidget.
  **/
 class YItemShortcut: public YShortcut
 {
@@ -240,10 +265,7 @@
     /**
      * Constructor.
      **/
-    YItemShortcut( YWidget * widget, YItem * item )
-       : YShortcut( widget )
-       , _item( item )
-       {}
+    YItemShortcut( YWidget * widget, YItem * item );
 
     /**
      * Destructor.
@@ -257,10 +279,26 @@
 
     /**
      * Set (override) the shortcut character.
+     *
+     * Reimplemented from YShortcut.
      * In this subclass, it will change the internally stored item.
      **/
     virtual void setShortcut( char newShortcut );
 
+    /**
+     * Returns 'true' if this is a shortcut for a (toplevel) menu item.
+     *
+     * Reimplemented from YShortcut.
+     **/
+    virtual bool isMenuItem() const { return _isMenuItem; }
+
+    /**
+     * Label of this shortcut suitable for debugging
+     **/
+    virtual std::string debugLabel() const
+        { return cleanShortcutString( _item->debugLabel() ); }
+
+
 protected:
 
     /**
@@ -273,9 +311,13 @@
 private:
 
     YItem * _item;
+    bool    _isMenuItem;
 };
 
 
+std::ostream & operator<<( std::ostream & stream, const YShortcut * shortcut );
+
+
 typedef std::vector<YShortcut *>       YShortcutList;
 typedef YShortcutList::iterator                YShortcutListIterator;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-3.12.1/src/YShortcutManager.cc 
new/libyui-3.12.2/src/YShortcutManager.cc
--- old/libyui-3.12.1/src/YShortcutManager.cc   2020-10-23 12:06:30.000000000 
+0200
+++ new/libyui-3.12.2/src/YShortcutManager.cc   2020-11-17 13:07:43.000000000 
+0100
@@ -42,7 +42,7 @@
 #define MIN_VALID_PERCENT      50
 
 // Return the number of elements of an array of any type
-#define DIM( ARRAY )   ( (int) ( sizeof( ARRAY)/( sizeof( ARRAY[0] ) ) ) )
+#define DIM( ARRAY )   ( (int) ( sizeof( ARRAY) / ( sizeof( ARRAY[0] ) ) ) )
 
 
 YShortcutManager::YShortcutManager( YDialog *dialog )
@@ -121,8 +121,7 @@
                _conflictCount++;
 
                yuiDebug() << "Shortcut conflict: '" << shortcut->preferred()
-                          << "' used for " << shortcut->widget()
-                          << endl;
+                          << "' used for " << shortcut << endl;
            }
        }
        else    // No or invalid shortcut
@@ -134,7 +133,7 @@
 
                if ( ! shortcut->widget()->autoShortcut() )
                {
-                   yuiDebug() << "No valid shortcut for " << 
shortcut->widget() << endl;
+                   yuiDebug() << "No valid shortcut for " << shortcut << endl;
                }
            }
        }
@@ -194,20 +193,10 @@
 
     while ( ! conflictList.empty() )
     {
-       //
-       // Pick a conflict widget to resolve.
-       //
-
-       // Wizard buttons have priority - check any of them first.
-       int prioIndex = findShortestWizardButton( conflictList );
-
-       if ( prioIndex < 0 )
-           prioIndex = findShortestWidget( conflictList); // Find the shortest 
widget. Buttons have priority.
-
-
-       // Pick a new shortcut for this widget.
-
+        int prioIndex        = pickConflictToResolve( conflictList );
        YShortcut * shortcut = conflictList[ prioIndex ];
+        // yuiDebug() << "Picked " << shortcut << endl;
+
        resolveConflict( shortcut );
 
        if ( shortcut->conflict() )
@@ -215,8 +204,8 @@
            yuiWarning() << "Couldn't resolve shortcut conflict for " << 
shortcut->widget() << endl;
        }
 
-
-       // Mark this particular conflict as resolved.
+       // Mark this particular conflict as resolved:
+        // Remove it from the conflict list.
 
        conflictList.erase( conflictList.begin() + prioIndex );
     }
@@ -228,11 +217,10 @@
 }
 
 
-
 void
 YShortcutManager::resolveConflict( YShortcut * shortcut )
 {
-    // yuiDebug() << "Picking shortcut for " << shortcut->widget() << endl;
+    // yuiDebug() << "Picking shortcut for " << shortcut << endl;
 
     char candidate = shortcut->preferred();                    // This is 
always normalized, no need to normalize again.
 
@@ -276,7 +264,7 @@
            else
            {
                yuiDebug() << "Reassigning shortcut '" << candidate
-                          << "' to " << shortcut->widget()
+                          << "' to " << shortcut
                           << endl;
            }
            shortcut->setShortcut( candidate );
@@ -284,7 +272,7 @@
        else
        {
            yuiDebug() << "Keeping preferred shortcut '" << candidate
-                      << "' for " << shortcut->widget()
+                      << "' for " << shortcut
                       << endl;
        }
 
@@ -306,6 +294,50 @@
 }
 
 
+int
+YShortcutManager::pickConflictToResolve( const YShortcutList & conflictList )
+{
+    int prioIndex = -1;
+
+    // Yes, the first  "if ( prioIndex < 0 )" is redundant, but that makes it
+    // much easier to rearrange priorities without nasty side effects.
+
+    if ( prioIndex < 0 )
+        prioIndex = findShortestMenuItem( conflictList );
+
+    if ( prioIndex < 0 )
+        prioIndex = findShortestWizardButton( conflictList );
+
+    if ( prioIndex < 0 )
+        prioIndex = findShortestWidget( conflictList );
+
+    return prioIndex;
+}
+
+
+int
+YShortcutManager::findShortestMenuItem( const YShortcutList & conflictList )
+{
+    int shortestIndex = -1;
+    int shortestLen   = -1;
+
+    for ( unsigned i=0; i < conflictList.size(); i++ )
+    {
+       if ( conflictList[i]->isMenuItem() )
+       {
+           if ( shortestLen < 0 ||
+                conflictList[i]->distinctShortcutChars() < shortestLen )
+           {
+               shortestIndex = i;
+               shortestLen   = conflictList[i]->distinctShortcutChars();
+           }
+
+       }
+    }
+
+    return shortestIndex;
+}
+
 
 int
 YShortcutManager::findShortestWizardButton( const YShortcutList & conflictList 
)
@@ -313,7 +345,7 @@
     int shortestIndex = -1;
     int shortestLen   = -1;
 
-    for ( unsigned i=1; i < conflictList.size(); i++ )
+    for ( unsigned i=0; i < conflictList.size(); i++ )
     {
        if ( conflictList[i]->isWizardButton() )
        {
@@ -331,7 +363,6 @@
 }
 
 
-
 unsigned
 YShortcutManager::findShortestWidget( const YShortcutList & conflictList )
 {
@@ -366,7 +397,6 @@
 }
 
 
-
 void
 YShortcutManager::clearShortcutList()
 {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libyui-3.12.1/src/YShortcutManager.h 
new/libyui-3.12.2/src/YShortcutManager.h
--- old/libyui-3.12.1/src/YShortcutManager.h    2020-10-23 12:06:30.000000000 
+0200
+++ new/libyui-3.12.2/src/YShortcutManager.h    2020-11-17 13:07:43.000000000 
+0100
@@ -125,6 +125,19 @@
     void resolveConflict( YShortcut * shortcut );
 
     /**
+     * Pick a conflict to resolve from 'conflictList' according to priorities
+     * (menu items, wizard buttons, buttons, other widgets) and return its
+     * index within 'conflictList'.
+     **/
+    int pickConflictToResolve( const YShortcutList & conflictList );
+
+    /**
+     * Find the shortest menu item in 'conflictList', if there is any.
+     * Returns the index of that shortest menu item or -1 if there is none.
+     **/
+    int findShortestMenuItem( const YShortcutList & conflictList );
+
+    /**
      * Find the shortest wizard button in 'conflictList', if there is any.
      * Returns the index of that shortest wizard button or -1 if there is none.
      **/
_______________________________________________
openSUSE Commits mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/[email protected]

Reply via email to