[aseprite] 87/128: Don't focus context bar when we use selection behavior modifiers (fix #1103)

Tobias Hansen thansen at moszumanska.debian.org
Mon May 9 21:24:26 UTC 2016


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

thansen pushed a commit to branch master
in repository aseprite.

commit 918acb6bc81a133e3da1174c2d9bcdc05647c56c
Author: David Capello <davidcapello at gmail.com>
Date:   Mon May 2 12:25:51 2016 -0300

    Don't focus context bar when we use selection behavior modifiers (fix #1103)
---
 src/app/ui/button_set.cpp  | 13 +++++++------
 src/app/ui/button_set.h    |  6 +++---
 src/app/ui/context_bar.cpp |  2 +-
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/app/ui/button_set.cpp b/src/app/ui/button_set.cpp
index 16f2d20..86e3c04 100644
--- a/src/app/ui/button_set.cpp
+++ b/src/app/ui/button_set.cpp
@@ -1,5 +1,5 @@
 // Aseprite
-// Copyright (C) 2001-2015  David Capello
+// Copyright (C) 2001-2016  David Capello
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License version 2 as
@@ -322,15 +322,15 @@ int ButtonSet::selectedItem() const
   return -1;
 }
 
-void ButtonSet::setSelectedItem(int index)
+void ButtonSet::setSelectedItem(int index, bool focusItem)
 {
   if (index >= 0 && index < (int)children().size())
-    setSelectedItem(static_cast<Item*>(at(index)));
+    setSelectedItem(static_cast<Item*>(at(index)), focusItem);
   else
-    setSelectedItem(static_cast<Item*>(NULL));
+    setSelectedItem(static_cast<Item*>(nullptr), focusItem);
 }
 
-void ButtonSet::setSelectedItem(Item* item)
+void ButtonSet::setSelectedItem(Item* item, bool focusItem)
 {
   if (!m_multipleSelection) {
     if (item && item->isSelected())
@@ -343,7 +343,8 @@ void ButtonSet::setSelectedItem(Item* item)
 
   if (item) {
     item->setSelected(!item->isSelected());
-    item->requestFocus();
+    if (focusItem)
+      item->requestFocus();
   }
 }
 
diff --git a/src/app/ui/button_set.h b/src/app/ui/button_set.h
index 40f7153..568c019 100644
--- a/src/app/ui/button_set.h
+++ b/src/app/ui/button_set.h
@@ -1,5 +1,5 @@
 // Aseprite
-// Copyright (C) 2001-2015  David Capello
+// Copyright (C) 2001-2016  David Capello
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License version 2 as
@@ -44,8 +44,8 @@ namespace app {
     Item* getItem(int index);
 
     int selectedItem() const;
-    void setSelectedItem(int index);
-    void setSelectedItem(Item* item);
+    void setSelectedItem(int index, bool focusItem = true);
+    void setSelectedItem(Item* item, bool focusItem = true);
     void deselectItems();
 
     void setOfferCapture(bool state);
diff --git a/src/app/ui/context_bar.cpp b/src/app/ui/context_bar.cpp
index 21e1272..7665745 100644
--- a/src/app/ui/context_bar.cpp
+++ b/src/app/ui/context_bar.cpp
@@ -1112,7 +1112,7 @@ public:
   }
 
   void setSelectionMode(gen::SelectionMode mode) {
-    setSelectedItem((int)mode);
+    setSelectedItem((int)mode, false);
     invalidate();
   }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list