On Fri, Sep 3, 2010 at 3:34 PM, Kurosu <kur...@free.fr> wrote:
> I was told that maybe the macro MAEMO5 exists. A quick google shows no code 
> using it though.

Well if it exists, it's not working for me ;)

> Therefore, I'm wondering how we should handle this. You probably use the 
> configure scripts, which can updated to detect Maemo. Probably ${host} 
> variable has enough maemo specific things, and we can add on the fly the 
> needed defines to the CFLAGS. Another possibility is adding them to the 
> generated config_autotools.h, which brings us to this topic from our private 
> discussion:

I'm just passing -DMAEMO to configure script along with other options.
I'll try to see what is the best way to detect maemo, but it's not
absolutely needed.

> Ah yes, you're right, I forgot I'm erasing all of the bindings when saving, 
> not just the ones set. But then this is a bug in control config, it shouldn't 
> do this.
>
>> Maybe Keyboard::SetDefaultConfig() could be used?
>
> I think we should be resilient rather than stomping onto a problem and seeing 
> the previous solution isn't perfect. I was bitten several times by this when 
> editing control config, and I will probably continue in spite of me, but I 
> think we should have ControlItem::SaveAction erase the initial binding then 
> add its own.

I made another approach to this problem, see attached patch. Now I
just switch fn+left/right keysym to up/down keysym. It's completely
invisible and doesn't need any special cases. This really should be
done in sdl, but since sdl in maemo is just a side product from Nokia
it really doesn't do anything which isn't absolutely necessary.

[different kb layouts]
> Can this be detected? If yes, and under a specific MAEMO-protected code 
> block, maybe we should try handling this.

It can be detected from OSSO_PRODUCT_KEYBOARD environment variable,
but it's not necessary. Only implication is that fn+left/right is same
as up/down.

>> We can continue our discussion on this list too, no problem.
>
> I hope our mails didn't cross and you didn't reply to my private mail.

>From my earlier mail regarding how to scroll list box, I missed the
fact that scrolling can be done by grabbing the list like I was hoping
to. I just didn't notice it because scrolling in general is very slow
and my attention was on scroll bars :)

-- 
Mikko
Index: src/interface/keyboard.cpp
===================================================================
--- src/interface/keyboard.cpp	(revision 8339)
+++ src/interface/keyboard.cpp	(working copy)
@@ -284,6 +284,12 @@
   SDLKey basic_key_code = event.key.keysym.sym;
   if (basic_key_code >= MODIFIER_OFFSET)
     return;
+#ifdef MAEMO
+  if (SDL_GetModState() & KMOD_MODE) {
+    if (basic_key_code == SDLK_LEFT) basic_key_code = SDLK_UP;
+    if (basic_key_code == SDLK_RIGHT) basic_key_code = SDLK_DOWN;
+  }
+#endif
   int key_code;
   if (modifier_bits != previous_modifier_bits) {
     std::set<SDLKey>::iterator it;
Index: src/interface/mouse.cpp
===================================================================
--- src/interface/mouse.cpp	(revision 8339)
+++ src/interface/mouse.cpp	(working copy)
@@ -340,10 +340,12 @@
 
 void Mouse::Show()
 {
+#if !defined(MAEMO)
   if (((Time::GetConstInstance()->Read()-last_hide_time) > 10000) && (visible == MOUSE_HIDDEN))
   {
     CenterPointer();
   }
+#endif
   visible = MOUSE_VISIBLE;
 
   if (Config::GetConstInstance()->GetDefaultMouseCursor()) {
Index: src/gui/control_config.cpp
===================================================================
--- src/gui/control_config.cpp	(revision 8339)
+++ src/gui/control_config.cpp	(working copy)
@@ -100,21 +100,23 @@
 
   virtual bool SendKey(const SDL_keysym & key)
   {
-    if (read_only || key.sym == SDLK_UNKNOWN)
+    SDLKey key_code = key.sym;
+
+    if (read_only || key_code == SDLK_UNKNOWN)
       return false;
 
     // Ignore modifiers-only key presses
-    if (key.sym >= SDLK_NUMLOCK && key.sym <= SDLK_COMPOSE)
+    if (key_code >= SDLK_NUMLOCK && key_code <= SDLK_COMPOSE)
       return true;
 
     Keyboard *kbd = Keyboard::GetInstance();
 
     // Reset some configs
-    if (SDLK_BACKSPACE == key.sym ||
+    if (SDLK_BACKSPACE == key_code ||
 #ifdef ANDROID
-        SDLK_ESCAPE == key.sym ||
+        SDLK_ESCAPE == key_code ||
 #endif
-        SDLK_DELETE == key.sym) {
+        SDLK_DELETE == key_code) {
       kbd->ClearKeyAction(key_action);
       label_key->SetText(_("None"));
       ctrl_box->SetValue(false);
@@ -131,13 +133,21 @@
     bool has_shift = mod_bits & KMOD_SHIFT;
     bool has_alt = mod_bits & KMOD_ALT;
     bool has_ctrl = mod_bits & KMOD_CTRL;
+#ifdef MAEMO
+    bool has_mode = mod_bits & KMOD_MODE;
 
+    if (has_mode) {
+      if (key_code == SDLK_LEFT) key_code = SDLK_UP;
+      if (key_code == SDLK_RIGHT) key_code = SDLK_DOWN;
+    }
+#endif
+
     for (std::vector<ControlItem*>::const_iterator it = selves->begin();
          it != selves->end();
          ++it) {
       const ControlItem *c = (*it);
 
-      if (c!=this && c->key_value==key.sym
+      if (c!=this && c->key_value==key_code
           && has_ctrl  == c->ctrl_box->GetValue()
           && has_alt   == c->alt_box->GetValue()
           && has_shift == c->shift_box->GetValue()) {
@@ -153,7 +163,7 @@
       }
     }
 
-    key_value = key.sym;
+    key_value = key_code;
     label_key->SetText(kbd->GetKeyNameFromKey(key_value));
 
     ctrl_box->SetValue(has_ctrl);
_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à