~ubuntu-branches/debian/sid/openbox/sid

« back to all changes in this revision

Viewing changes to openbox/translate.c

  • Committer: Bazaar Package Importer
  • Author(s): Nico Golde, Nico Golde, Eugenio Paolantonio
  • Date: 2011-10-03 22:59:30 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20111003225930-tdvyax5tx63dyoez
Tags: 3.5.0-1
[Nico Golde]
* New upstream release (Closes: #638783).
  - Fix crashes in the menu code (Closes: #563891).
* Add Brazilian translation to openbox.desktop,
  thanks Sérgio Cipolla (Closes: #627912).
* Remove 06_fix_swap_byte_order.patch, applied upstream.
* Bump debhelper dependency to >= 7.0.50~ due to override.
* Remove CHANGELOG from openbox.docs to prevent double installation.
* Add 02_fix_freedesktop_compliance.dpatch desktop file to
  /usr/share/applications.

[Eugenio Paolantonio]
* debian/patches:
  - Disabled 03_place_windows_in_quadrants.patch
  - Updated 01_rc.xml.patch and 06_fix_swap_byte_order.patch
  - Removed 04_fix_ftbfs_no-add-needed.patch and 20_24bits_support.patch
* debian/control:
  - Added myself to the Uploaders.
  - Build-Depends: removed libxau-dev, libxft-dev and python-xdg;
    added libimlib2-dev
  - openbox Suggests: added python-xdg
  - libobrender21 renamed to libobrender27
  - libobparser21 renamed to libobt0
* debian/rules:
  - Rewrote using a simpler debhelper syntax
  - Moved the install pass to openbox.install
* debian/*.{install,links,dirs}:
  - Updated.
* debian/openbox.xsession:
  - Removed. Openbox now ships it by default.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include "openbox.h"
21
21
#include "mouse.h"
22
 
#include "modkeys.h"
23
 
#include "translate.h"
24
22
#include "gettext.h"
 
23
#include "obt/keyboard.h"
 
24
 
25
25
#include <glib.h>
26
26
#include <string.h>
27
27
#include <stdlib.h>
38
38
 
39
39
    else if (!g_ascii_strcasecmp("Control", str) ||
40
40
             !g_ascii_strcasecmp("C", str))
41
 
        mask = modkeys_key_to_mask(OB_MODKEY_KEY_CONTROL);
 
41
        mask = obt_keyboard_modkey_to_modmask(OBT_KEYBOARD_MODKEY_CONTROL);
42
42
    else if (!g_ascii_strcasecmp("Alt", str) ||
43
43
             !g_ascii_strcasecmp("A", str))
44
 
        mask = modkeys_key_to_mask(OB_MODKEY_KEY_ALT);
 
44
        mask = obt_keyboard_modkey_to_modmask(OBT_KEYBOARD_MODKEY_ALT);
45
45
    else if (!g_ascii_strcasecmp("Meta", str) ||
46
46
             !g_ascii_strcasecmp("M", str))
47
 
        mask = modkeys_key_to_mask(OB_MODKEY_KEY_META);
 
47
        mask = obt_keyboard_modkey_to_modmask(OBT_KEYBOARD_MODKEY_META);
48
48
    /* W = windows key, is linked to the Super_L/R buttons */
49
49
    else if (!g_ascii_strcasecmp("Super", str) ||
50
50
             !g_ascii_strcasecmp("W", str))
51
 
        mask = modkeys_key_to_mask(OB_MODKEY_KEY_SUPER);
 
51
        mask = obt_keyboard_modkey_to_modmask(OBT_KEYBOARD_MODKEY_SUPER);
52
52
    else if (!g_ascii_strcasecmp("Shift", str) ||
53
53
             !g_ascii_strcasecmp("S", str))
54
 
        mask = modkeys_key_to_mask(OB_MODKEY_KEY_SHIFT);
 
54
        mask = obt_keyboard_modkey_to_modmask(OBT_KEYBOARD_MODKEY_SHIFT);
55
55
    else if (!g_ascii_strcasecmp("Hyper", str) ||
56
56
             !g_ascii_strcasecmp("H", str))
57
 
        mask = modkeys_key_to_mask(OB_MODKEY_KEY_HYPER);
 
57
        mask = obt_keyboard_modkey_to_modmask(OBT_KEYBOARD_MODKEY_HYPER);
58
58
    else
59
59
        g_message(_("Invalid modifier key \"%s\" in key/mouse binding"), str);
60
60
 
145
145
            g_message(_("Invalid key name \"%s\" in key binding"), l);
146
146
            goto translation_fail;
147
147
        }
148
 
        *keycode = XKeysymToKeycode(ob_display, sym);
 
148
        *keycode = XKeysymToKeycode(obt_display, sym);
149
149
    }
150
150
    if (!*keycode) {
151
151
        g_message(_("Requested key \"%s\" does not exist on the display"), l);
158
158
    g_strfreev(parsed);
159
159
    return ret;
160
160
}
161
 
 
162
 
gchar *translate_keycode(guint keycode)
163
 
{
164
 
    KeySym sym;
165
 
    const gchar *ret = NULL;
166
 
 
167
 
    if ((sym = XKeycodeToKeysym(ob_display, keycode, 0)) != NoSymbol)
168
 
        ret = XKeysymToString(sym);
169
 
    /* glib crashes in g_locale_to_utf8 if you pass it NULL here */
170
 
    if (ret)
171
 
        return g_locale_to_utf8(ret, -1, NULL, NULL, NULL);
172
 
    else
173
 
        return NULL;
174
 
}
175
 
 
176
 
gunichar translate_unichar(guint keycode)
177
 
{
178
 
    gunichar unikey = 0;
179
 
 
180
 
    char *key;
181
 
    if ((key = translate_keycode(keycode)) != NULL &&
182
 
        /* don't accept keys that aren't a single letter, like "space" */
183
 
        key[1] == '\0')
184
 
    {
185
 
        unikey = g_utf8_get_char_validated(key, -1);
186
 
        if (unikey == (gunichar)-1 || unikey == (gunichar)-2 || unikey == 0)
187
 
            unikey = 0;
188
 
    }
189
 
    g_free(key);
190
 
    return unikey;
191
 
}