Hi,

Still no idea on how to commit code to cim5 (access to git repo
somewhere?) Anyways, attached is a patch for home/end keys on buddylist,
menus etc.

/PH

--
Per-Henrik Lundblom           epost: p...@whatever.nu
telefon: 0733-20 71 26        hemsida: www.whatever.nu

>From e0516033530edd536d89c42bcfefa2a408796024 Mon Sep 17 00:00:00 2001
From: Per-Henrik Lundblom <p...@whatever.nu>
Date: Thu, 22 Dec 2011 11:49:03 +0100
Subject: [PATCH] Support for Home/End keys in UI container context

---
 cppconsui/Container.cpp |   17 +++++++++++++++++
 cppconsui/Container.h   |    4 +++-
 cppconsui/KeyConfig.cpp |    2 ++
 3 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/cppconsui/Container.cpp b/cppconsui/Container.cpp
index 4a9d720..c53b85c 100644
--- a/cppconsui/Container.cpp
+++ b/cppconsui/Container.cpp
@@ -337,8 +337,13 @@ void Container::MoveFocus(FocusDirection direction)
     case FOCUS_UP:
     case FOCUS_LEFT:
     case FOCUS_PAGE_UP:
+    case FOCUS_BEGIN:
       // finally, find the previous widget which will get the focus
       do {
+        if (direction == FOCUS_BEGIN) {
+          iter = parent_iter.begin();
+          goto end;
+        }
         /* If no focus cycling is allowed, stop if the widget with focus is the
          * first/last child. */
         if (scope == FOCUS_CYCLE_NONE && iter == parent_iter.begin())
@@ -357,8 +362,14 @@ void Container::MoveFocus(FocusDirection direction)
     case FOCUS_DOWN:
     case FOCUS_RIGHT:
     case FOCUS_PAGE_DOWN:
+    case FOCUS_END:
       // finally, find the next widget which will get the focus
       do {
+        if (direction == FOCUS_END) {
+          iter = parent_iter.end();
+          iter--;
+          goto end;
+        }
         if (scope == FOCUS_CYCLE_NONE && iter == --parent_iter.end())
           goto end;
 
@@ -490,6 +501,12 @@ void Container::DeclareBindables()
   DeclareBindable("container", "focus-page-down",
       sigc::bind(sigc::mem_fun(this, &Container::MoveFocus),
         Container::FOCUS_PAGE_DOWN), InputProcessor::BINDABLE_NORMAL);
+  DeclareBindable("container", "focus-begin",
+      sigc::bind(sigc::mem_fun(this, &Container::MoveFocus),
+        Container::FOCUS_BEGIN), InputProcessor::BINDABLE_NORMAL);
+  DeclareBindable("container", "focus-end",
+      sigc::bind(sigc::mem_fun(this, &Container::MoveFocus),
+        Container::FOCUS_END), InputProcessor::BINDABLE_NORMAL);
 }
 
 } // namespace CppConsUI
diff --git a/cppconsui/Container.h b/cppconsui/Container.h
index ec1aa58..b728396 100644
--- a/cppconsui/Container.h
+++ b/cppconsui/Container.h
@@ -76,7 +76,9 @@ public:
     FOCUS_LEFT,
     FOCUS_RIGHT,
     FOCUS_PAGE_UP,
-    FOCUS_PAGE_DOWN
+    FOCUS_PAGE_DOWN,
+    FOCUS_BEGIN,
+    FOCUS_END
   };
 
   Container(int w, int h);
diff --git a/cppconsui/KeyConfig.cpp b/cppconsui/KeyConfig.cpp
index 45a96af..e87861d 100644
--- a/cppconsui/KeyConfig.cpp
+++ b/cppconsui/KeyConfig.cpp
@@ -285,6 +285,8 @@ KeyConfig::KeyConfig()
   AddDefaultKeyBind("container", "focus-right", "Right");
   AddDefaultKeyBind("container", "focus-page-up", "PageUp");
   AddDefaultKeyBind("container", "focus-page-down", "PageDown");
+  AddDefaultKeyBind("container", "focus-begin", "Home");
+  AddDefaultKeyBind("container", "focus-end", "End");
 
   AddDefaultKeyBind("coremanager", "redraw-screen", "Ctrl-l");
 
-- 
1.7.0.4

-- 
_______________________________________________
Centerim-devel mailing list
Centerim-devel@centerim.org
http://centerim.org/mailman/listinfo/centerim-devel
http://www.centerim.org/

Reply via email to