wok-6.x rev 6394

Bumped some packages by adding a empty line. Added a patch to lxpanel to fix failure to react to keyboard map changes. Added DEPENDS to BUILD_DEPENDS of gnome-mplayer.
author Christopher Rogers <slaxemulator@gmail.com>
date Fri Sep 24 04:32:19 2010 +0000 (2010-09-24)
parents 89382e31e2cd
children 36a0e1608714
files cdrdao-utils/receipt cdrdao/receipt gnome-mplayer/receipt grsync/receipt gtk+/receipt lxpanel/receipt lxpanel/stuff/Fix-failure-to-react-to-keyboard-map-changes-initiat.patch
line diff
     1.1 --- a/cdrdao-utils/receipt	Fri Sep 24 02:27:38 2010 +0000
     1.2 +++ b/cdrdao-utils/receipt	Fri Sep 24 04:32:19 2010 +0000
     1.3 @@ -14,6 +14,5 @@
     1.4  {
     1.5  	mkdir -p $fs/usr/bin
     1.6  	cp -a $_pkg/usr/bin/ $fs/usr
     1.7 -	rm $fs/usr/bin/cdrdao	
     1.8 -
     1.9 +	rm $fs/usr/bin/cdrdao
    1.10  }
     2.1 --- a/cdrdao/receipt	Fri Sep 24 02:27:38 2010 +0000
     2.2 +++ b/cdrdao/receipt	Fri Sep 24 04:32:19 2010 +0000
     2.3 @@ -36,5 +36,4 @@
     2.4  	mkdir -p $fs/usr/bin
     2.5  	cp -a $_pkg/usr/bin/cdrdao $fs/usr/bin
     2.6  	cp -a $_pkg/usr/share $fs/usr
     2.7 -
     2.8  }
     3.1 --- a/gnome-mplayer/receipt	Fri Sep 24 02:27:38 2010 +0000
     3.2 +++ b/gnome-mplayer/receipt	Fri Sep 24 04:32:19 2010 +0000
     3.3 @@ -5,8 +5,8 @@
     3.4  CATEGORY="multimedia"
     3.5  SHORT_DESC="simple MPlayer GUI"
     3.6  MAINTAINER="jozee@slitaz.org"
     3.7 -DEPENDS="mplayer dbus-glib libnotify alsa-lib libgpod"
     3.8 -BUILD_DEPENDS="mplayer dbus-dev dbus-glib-dev libnotify libnotify-dev libgpod libgpod-dev pkg-config xorg-libX11-dev libxcb-dev gtk+-dev xorg-libXss-dev"
     3.9 +DEPENDS="mplayer gtk+ dbus-glib libnotify alsa-lib libgpod"
    3.10 +BUILD_DEPENDS="$DEPENDS dbus-dev dbus-glib-dev libnotify-dev libgpod-dev pkg-config xorg-libX11-dev libxcb-dev gtk+-dev xorg-libXss-dev"
    3.11  SUGGESTED="libgpod"
    3.12  TARBALL="$PACKAGE-$VERSION.tar.gz"
    3.13  WEB_SITE="http://gnome-mplayer.googlecode.com/" 
     4.1 --- a/grsync/receipt	Fri Sep 24 02:27:38 2010 +0000
     4.2 +++ b/grsync/receipt	Fri Sep 24 04:32:19 2010 +0000
     4.3 @@ -34,3 +34,4 @@
     4.4      	sed -i s'|#!/bin/bash|#!/bin/sh|' $fs/usr/bin/grsync-batch
     4.5  	chmod +x $fs/usr/bin/*
     4.6  }
     4.7 +
     5.1 --- a/gtk+/receipt	Fri Sep 24 02:27:38 2010 +0000
     5.2 +++ b/gtk+/receipt	Fri Sep 24 04:32:19 2010 +0000
     5.3 @@ -76,3 +76,4 @@
     5.4  		rm -rf $1/usr/lib/gtk-2.0/2.4.0
     5.5  	fi
     5.6  }
     5.7 +
     6.1 --- a/lxpanel/receipt	Fri Sep 24 02:27:38 2010 +0000
     6.2 +++ b/lxpanel/receipt	Fri Sep 24 04:32:19 2010 +0000
     6.3 @@ -19,6 +19,7 @@
     6.4  compile_rules()
     6.5  {
     6.6  	cd $src
     6.7 +	patch -p1 -i ../stuff/Fix-failure-to-react-to-keyboard-map-changes-initiat.patch
     6.8  	./configure \
     6.9  		--prefix=/usr \
    6.10  		--sysconfdir=/etc \
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/lxpanel/stuff/Fix-failure-to-react-to-keyboard-map-changes-initiat.patch	Fri Sep 24 04:32:19 2010 +0000
     7.3 @@ -0,0 +1,555 @@
     7.4 +From 438d9fdbd3e0be04de933705917d508a02b7c04b Mon Sep 17 00:00:00 2001
     7.5 +From: Marty Jack <martyj@linux.local>
     7.6 +Date: Sat, 20 Feb 2010 16:23:57 -0500
     7.7 +Subject: [PATCH 4/5] Fix failure to react to keyboard map changes initiated outside the plugin
     7.8 + - Occurred when setxkbmap was run, or when HAL configured the keyboard at X startup
     7.9 + - Caused by failure to process the NewKeyboard event
    7.10 + - Caused by dropping events due to faulty code to read them
    7.11 + - Cosmetic change, the tooltip now the Xkb Group name rather than Xkb Symbol name
    7.12 +
    7.13 +---
    7.14 + src/plugins/xkb/xkb-plugin.c |   92 +++++++++--------
    7.15 + src/plugins/xkb/xkb.c        |  236 +++++++++++++++++++++--------------------
    7.16 + src/plugins/xkb/xkb.h        |    7 +-
    7.17 + 3 files changed, 173 insertions(+), 162 deletions(-)
    7.18 +
    7.19 +diff --git a/src/plugins/xkb/xkb-plugin.c b/src/plugins/xkb/xkb-plugin.c
    7.20 +index f49a77d..80a14ba 100644
    7.21 +--- a/src/plugins/xkb/xkb-plugin.c
    7.22 ++++ b/src/plugins/xkb/xkb-plugin.c
    7.23 +@@ -1,18 +1,23 @@
    7.24 +-/*
    7.25 +-//====================================================================
    7.26 +-//  xfce4-xkb-plugin - XFCE4 Xkb Layout Indicator panel plugin
    7.27 +-// -------------------------------------------------------------------
    7.28 +-//  Alexander Iliev <sasoiliev@mamul.org>
    7.29 +-//  20-Feb-04
    7.30 +-// -------------------------------------------------------------------
    7.31 +-//  Parts of this code belong to Michael Glickman <wmalms@yahooo.com>
    7.32 +-//  and his program wmxkb.
    7.33 +-//  WARNING: DO NOT BOTHER Michael Glickman WITH QUESTIONS ABOUT THIS
    7.34 +-//           PROGRAM!!! SEND INSTEAD EMAILS TO <sasoiliev@mamul.org>
    7.35 +-//====================================================================
    7.36 +-*/
    7.37 +-
    7.38 +-/* Modified by Hong Jen Yee (PCMan) <pcman.tw@gmail.com> on 2008-04-06 for lxpanel */
    7.39 ++/**
    7.40 ++ * Copyright (c) 2010 LxDE Developers, see the file AUTHORS for details.
    7.41 ++ *
    7.42 ++ * This program is free software; you can redistribute it and/or modify
    7.43 ++ * it under the terms of the GNU General Public License as published by
    7.44 ++ * the Free Software Foundation; either version 2 of the License, or
    7.45 ++ * (at your option) any later version.
    7.46 ++ *
    7.47 ++ * This program is distributed in the hope that it will be useful,
    7.48 ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
    7.49 ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7.50 ++ * GNU General Public License for more details.
    7.51 ++ *
    7.52 ++ * You should have received a copy of the GNU General Public License
    7.53 ++ * along with this program; if not, write to the Free Software Foundation,
    7.54 ++ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
    7.55 ++ */
    7.56 ++
    7.57 ++/* Originally derived from xfce4-xkb-plugin, Copyright 2004 Alexander Iliev,
    7.58 ++ * which credits Michael Glickman. */
    7.59 + 
    7.60 + #ifdef HAVE_CONFIG_H
    7.61 + #include <config.h>
    7.62 +@@ -49,38 +54,45 @@ void xkb_redraw(XkbPlugin * xkb)
    7.63 +     if (xkb->display_type == IMAGE)
    7.64 +     {
    7.65 +         int size = xkb->plugin->panel->icon_size;
    7.66 +-        char * group_name = (char *) xkb_get_current_group_name_lowercase(xkb);
    7.67 +-        char * filename = g_strdup_printf("%s/%s.png", FLAGSDIR, group_name);
    7.68 +-        GdkPixbuf * unscaled_pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
    7.69 +-        g_free(filename);
    7.70 +-        g_free(group_name);
    7.71 +-
    7.72 +-        if (unscaled_pixbuf != NULL)
    7.73 ++        char * group_name = (char *) xkb_get_current_symbol_name_lowercase(xkb);
    7.74 ++        if (group_name != NULL)
    7.75 +         {
    7.76 +-            /* Loaded successfully. */
    7.77 +-            int width = gdk_pixbuf_get_width(unscaled_pixbuf);
    7.78 +-            int height = gdk_pixbuf_get_height(unscaled_pixbuf);
    7.79 +-            GdkPixbuf * pixbuf = gdk_pixbuf_scale_simple(unscaled_pixbuf, size * width / height, size, GDK_INTERP_BILINEAR);
    7.80 +-            if (pixbuf != NULL)
    7.81 ++            char * filename = g_strdup_printf("%s/%s.png", FLAGSDIR, group_name);
    7.82 ++            GdkPixbuf * unscaled_pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
    7.83 ++            g_free(filename);
    7.84 ++            g_free(group_name);
    7.85 ++
    7.86 ++            if (unscaled_pixbuf != NULL)
    7.87 +             {
    7.88 +-                gtk_image_set_from_pixbuf(GTK_IMAGE(xkb->image), pixbuf);
    7.89 +-                g_object_unref(G_OBJECT(pixbuf));
    7.90 +-                gtk_widget_hide(xkb->label);
    7.91 +-                gtk_widget_show(xkb->image);
    7.92 +-                gtk_widget_set_tooltip_text(xkb->btn, xkb_get_current_group_name(xkb));
    7.93 +-                valid_image = TRUE;
    7.94 ++                /* Loaded successfully. */
    7.95 ++                int width = gdk_pixbuf_get_width(unscaled_pixbuf);
    7.96 ++                int height = gdk_pixbuf_get_height(unscaled_pixbuf);
    7.97 ++                GdkPixbuf * pixbuf = gdk_pixbuf_scale_simple(unscaled_pixbuf, size * width / height, size, GDK_INTERP_BILINEAR);
    7.98 ++                if (pixbuf != NULL)
    7.99 ++                {
   7.100 ++                    gtk_image_set_from_pixbuf(GTK_IMAGE(xkb->image), pixbuf);
   7.101 ++                    g_object_unref(G_OBJECT(pixbuf));
   7.102 ++                    gtk_widget_hide(xkb->label);
   7.103 ++                    gtk_widget_show(xkb->image);
   7.104 ++                    gtk_widget_set_tooltip_text(xkb->btn, xkb_get_current_group_name(xkb));
   7.105 ++                    valid_image = TRUE;
   7.106 ++                }
   7.107 ++                g_object_unref(unscaled_pixbuf);
   7.108 +             }
   7.109 +-            g_object_unref(unscaled_pixbuf);
   7.110 +         }
   7.111 +     }
   7.112 + 
   7.113 +     /* Set the label. */
   7.114 +     if ((xkb->display_type == TEXT) || ( ! valid_image))
   7.115 +     {
   7.116 +-        panel_draw_label_text(xkb->plugin->panel, xkb->label, (char *) xkb_get_current_group_name(xkb), TRUE, TRUE);
   7.117 +-        gtk_widget_hide(xkb->image);
   7.118 +-        gtk_widget_show(xkb->label);
   7.119 +-        gtk_widget_set_tooltip_text(xkb->btn, NULL);
   7.120 ++        char * group_name = (char *) xkb_get_current_symbol_name(xkb);
   7.121 ++        if (group_name != NULL)
   7.122 ++        {
   7.123 ++            panel_draw_label_text(xkb->plugin->panel, xkb->label, (char *) group_name, TRUE, TRUE);
   7.124 ++            gtk_widget_hide(xkb->image);
   7.125 ++            gtk_widget_show(xkb->label);
   7.126 ++            gtk_widget_set_tooltip_text(xkb->btn, xkb_get_current_group_name(xkb));
   7.127 ++        }
   7.128 +     }
   7.129 + }
   7.130 + 
   7.131 +@@ -196,10 +208,6 @@ static int xkb_constructor(Plugin * plugin, char ** fp)
   7.132 +     /* Initialize the XKB interface. */
   7.133 +     xkb_mechanism_constructor(xkb);
   7.134 + 
   7.135 +-    /* Initialize a channel to listen for XKB events. */
   7.136 +-    GIOChannel * channel = g_io_channel_unix_new(xkb_get_connection_number(xkb));
   7.137 +-    xkb->source_id = g_io_add_watch(channel, G_IO_IN | G_IO_PRI, (GIOFunc) xkb_gio_callback, (gpointer) xkb);
   7.138 +-
   7.139 +     /* Connect signals. */
   7.140 +     g_signal_connect(xkb->btn, "button-press-event", G_CALLBACK(xkb_button_press_event), xkb);
   7.141 +     g_signal_connect(xkb->btn, "scroll-event", G_CALLBACK(xkb_scroll_event), xkb);
   7.142 +diff --git a/src/plugins/xkb/xkb.c b/src/plugins/xkb/xkb.c
   7.143 +index 5bb0c39..898a931 100644
   7.144 +--- a/src/plugins/xkb/xkb.c
   7.145 ++++ b/src/plugins/xkb/xkb.c
   7.146 +@@ -1,18 +1,23 @@
   7.147 +-/*
   7.148 +-// ====================================================================
   7.149 +-//  xfce4-xkb-plugin - XFCE4 Xkb Layout Indicator panel plugin
   7.150 +-// -------------------------------------------------------------------
   7.151 +-//  Alexander Iliev <sasoiliev@mamul.org>
   7.152 +-//  20-Feb-04
   7.153 +-// -------------------------------------------------------------------
   7.154 +-//  Parts of this code belong to Michael Glickman <wmalms@yahooo.com>
   7.155 +-//  and his program wmxkb.
   7.156 +-//  WARNING: DO NOT BOTHER Michael Glickman WITH QUESTIONS ABOUT THIS
   7.157 +-//           PROGRAM!!! SEND INSTEAD EMAILS TO <sasoiliev@mamul.org>
   7.158 +-//====================================================================
   7.159 +-*/
   7.160 +-
   7.161 +-/* Modified by Hong Jen Yee (PCMan) <pcman.tw@gmail.com> on 2008-04-06 for lxpanel */
   7.162 ++/**
   7.163 ++ * Copyright (c) 2010 LxDE Developers, see the file AUTHORS for details.
   7.164 ++ *
   7.165 ++ * This program is free software; you can redistribute it and/or modify
   7.166 ++ * it under the terms of the GNU General Public License as published by
   7.167 ++ * the Free Software Foundation; either version 2 of the License, or
   7.168 ++ * (at your option) any later version.
   7.169 ++ *
   7.170 ++ * This program is distributed in the hope that it will be useful,
   7.171 ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
   7.172 ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   7.173 ++ * GNU General Public License for more details.
   7.174 ++ *
   7.175 ++ * You should have received a copy of the GNU General Public License
   7.176 ++ * along with this program; if not, write to the Free Software Foundation,
   7.177 ++ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   7.178 ++ */
   7.179 ++
   7.180 ++/* Originally derived from xfce4-xkb-plugin, Copyright 2004 Alexander Iliev,
   7.181 ++ * which credits Michael Glickman. */
   7.182 + 
   7.183 + #include "xkb.h"
   7.184 + 
   7.185 +@@ -26,9 +31,13 @@
   7.186 + #include <gdk-pixbuf/gdk-pixbuf.h>
   7.187 + #include <glib.h>
   7.188 + 
   7.189 ++/* The X Keyboard Extension: Library Specification
   7.190 ++ * http://www.xfree86.org/current/XKBlib.pdf */
   7.191 ++
   7.192 + static void xkb_enter_locale_by_process(XkbPlugin * xkb);
   7.193 + static void refresh_group_xkb(XkbPlugin * xkb);
   7.194 +-static int do_init_xkb(XkbPlugin * xkb);
   7.195 ++static int initialize_keyboard_description(XkbPlugin * xkb);
   7.196 ++static GdkFilterReturn xkb_event_filter(GdkXEvent * xevent, GdkEvent * event, XkbPlugin * xkb);
   7.197 + 
   7.198 + /* Insert a process and its layout into the hash table. */
   7.199 + static void xkb_enter_locale_by_process(XkbPlugin * xkb)
   7.200 +@@ -56,60 +65,65 @@ int xkb_get_group_count(XkbPlugin * xkb)
   7.201 +   return xkb->group_count;
   7.202 + }
   7.203 + 
   7.204 ++/* Get the current group name. */
   7.205 ++const char * xkb_get_current_group_name(XkbPlugin * xkb) 
   7.206 ++{
   7.207 ++    return xkb->group_names[xkb->current_group_xkb_no];
   7.208 ++}
   7.209 ++
   7.210 + /* Convert a group number to a symbol name. */
   7.211 + const char * xkb_get_symbol_name_by_res_no(XkbPlugin * xkb, int n) 
   7.212 + {
   7.213 +     return xkb->symbol_names[n];
   7.214 + }
   7.215 + 
   7.216 +-/* Get the current group name. */
   7.217 +-const char * xkb_get_current_group_name(XkbPlugin * xkb) 
   7.218 ++/* Get the current symbol name. */
   7.219 ++const char * xkb_get_current_symbol_name(XkbPlugin * xkb) 
   7.220 + {
   7.221 +     return xkb_get_symbol_name_by_res_no(xkb, xkb->current_group_xkb_no);
   7.222 + }
   7.223 + 
   7.224 +-/* Get the current group name converted to lowercase. */
   7.225 +-const char * xkb_get_current_group_name_lowercase(XkbPlugin * xkb) 
   7.226 ++/* Get the current symbol name converted to lowercase. */
   7.227 ++const char * xkb_get_current_symbol_name_lowercase(XkbPlugin * xkb) 
   7.228 + {
   7.229 +-    const char * tmp = xkb_get_current_group_name(xkb);
   7.230 +-    return g_utf8_strdown(tmp, -1);
   7.231 ++    const char * tmp = xkb_get_current_symbol_name(xkb);
   7.232 ++    return ((tmp != NULL) ? g_utf8_strdown(tmp, -1) : NULL);
   7.233 + }
   7.234 + 
   7.235 + /* Refresh current group number from Xkb state. */
   7.236 + static void refresh_group_xkb(XkbPlugin * xkb) 
   7.237 + {
   7.238 +     XkbStateRec xkb_state;
   7.239 +-    XkbGetState(xkb->dsp, xkb->device_id, &xkb_state);
   7.240 ++    XkbGetState(GDK_DISPLAY(), XkbUseCoreKbd, &xkb_state);
   7.241 +     xkb->current_group_xkb_no = xkb_state.group;
   7.242 + }
   7.243 + 
   7.244 +-/* Initialize the Xkb structures. */
   7.245 +-static int do_init_xkb(XkbPlugin * xkb) 
   7.246 ++/* Initialize the keyboard description initially or after a NewKeyboard event. */
   7.247 ++static int initialize_keyboard_description(XkbPlugin * xkb)
   7.248 + {
   7.249 +-    /* Create hash table. */
   7.250 +-    xkb->group_hash_table = g_hash_table_new(g_direct_hash, NULL);
   7.251 +-
   7.252 +-    /* Initialize the Xkb extension. */
   7.253 +-    int major, minor, opcode;
   7.254 +-    Bool status = XkbQueryExtension(xkb->dsp, &opcode,
   7.255 +-        &xkb->base_event_code, &xkb->base_error_code, &major, &minor);
   7.256 +-
   7.257 +-    /* Use the core keyboard. */
   7.258 +-    xkb->device_id = XkbUseCoreKbd;
   7.259 ++    /* Free the strings. */
   7.260 ++    int i;
   7.261 ++    for (i = 0; i < XkbNumKbdGroups; i += 1)
   7.262 ++    {
   7.263 ++        g_free(xkb->group_names[i]);
   7.264 ++        g_free(xkb->symbol_names[i]);
   7.265 ++        xkb->group_names[i] = NULL;
   7.266 ++        xkb->symbol_names[i] = NULL;
   7.267 ++    }
   7.268 + 
   7.269 +     /* Allocate a keyboard description structure. */
   7.270 ++    int status = False;
   7.271 +     XkbDescRec * kbd_desc_ptr = XkbAllocKeyboard();
   7.272 +     if (kbd_desc_ptr == NULL)
   7.273 +     {
   7.274 +         ERR("Failed to get keyboard description\n");
   7.275 +         goto HastaLaVista;
   7.276 +     }
   7.277 +-    kbd_desc_ptr->dpy = xkb->dsp;
   7.278 + 
   7.279 +     /* Fetch information into the keyboard description. */
   7.280 +-    XkbGetControls(xkb->dsp, XkbAllControlsMask, kbd_desc_ptr);
   7.281 +-    XkbGetNames(xkb->dsp, XkbSymbolsNameMask, kbd_desc_ptr);
   7.282 +-    XkbGetNames(xkb->dsp, XkbGroupNamesMask, kbd_desc_ptr);
   7.283 ++    XkbGetControls(GDK_DISPLAY(), XkbAllControlsMask, kbd_desc_ptr);
   7.284 ++    XkbGetNames(GDK_DISPLAY(), XkbSymbolsNameMask, kbd_desc_ptr);
   7.285 ++    XkbGetNames(GDK_DISPLAY(), XkbGroupNamesMask, kbd_desc_ptr);
   7.286 + 
   7.287 +     if (kbd_desc_ptr->names == NULL)
   7.288 +     {
   7.289 +@@ -137,12 +151,11 @@ static int do_init_xkb(XkbPlugin * xkb)
   7.290 + 
   7.291 +     /* Determine the group names.  Trim off text beginning at a '('. */
   7.292 +     const Atom * tmp_group_source = kbd_desc_ptr->names->groups;
   7.293 +-    int i;
   7.294 +     for (i = 0; i < xkb->group_count; i++)
   7.295 +     {
   7.296 +         if (tmp_group_source[i] != None)
   7.297 +         {
   7.298 +-            char * ptr = XGetAtomName(xkb->dsp, tmp_group_source[i]);
   7.299 ++            char * ptr = XGetAtomName(GDK_DISPLAY(), tmp_group_source[i]);
   7.300 +             xkb->group_names[i] = ptr;
   7.301 +             if ((ptr != NULL) && ((ptr = strchr(ptr, '('))) != NULL)
   7.302 +                 *ptr = '\0';
   7.303 +@@ -153,7 +166,7 @@ static int do_init_xkb(XkbPlugin * xkb)
   7.304 +     Atom sym_name_atom = kbd_desc_ptr->names->symbols;
   7.305 +     char * sym_name;
   7.306 +     if ((sym_name_atom == None)
   7.307 +-    || ((sym_name = XGetAtomName(xkb->dsp, sym_name_atom)) == NULL))
   7.308 ++    || ((sym_name = XGetAtomName(GDK_DISPLAY(), sym_name_atom)) == NULL))
   7.309 +         goto HastaLaVista;
   7.310 + 
   7.311 +     /* Parse and store symbol names. */
   7.312 +@@ -190,83 +203,106 @@ static int do_init_xkb(XkbPlugin * xkb)
   7.313 +     {
   7.314 +         xkb->group_count = 2;
   7.315 +         xkb->symbol_names[1] = xkb->symbol_names[0];
   7.316 +-        xkb->symbol_names[0] = strdup("us");
   7.317 +-        xkb->group_names[0] = strdup("US/ASCII");
   7.318 +-        xkb->group_names[1] = strdup("Japanese");
   7.319 ++        xkb->symbol_names[0] = g_strdup("us");
   7.320 ++        xkb->group_names[0] = g_strdup("US/ASCII");
   7.321 ++        xkb->group_names[1] = g_strdup("Japanese");
   7.322 +     }
   7.323 +     else if (count < xkb->group_count)
   7.324 +     {
   7.325 +         /* Ensure that the names are fully initialized. */
   7.326 +         int j = count, k = xkb->group_count;
   7.327 +         while(--j >= 0) xkb->symbol_names[--k] = xkb->symbol_names[j];
   7.328 +-        while(--k >= 0) xkb->symbol_names[k] = strdup("en_US");
   7.329 ++        while(--k >= 0) xkb->symbol_names[k] = g_strdup("en_US");
   7.330 +     }
   7.331 + 
   7.332 +-    /* Enxure that the names are fully initialized. */
   7.333 ++    /* Ensure that the names are fully initialized. */
   7.334 +     for (i = 0; i < xkb->group_count; i++)
   7.335 +     {
   7.336 +         if (xkb->symbol_names[i] == NULL)
   7.337 +         {
   7.338 +             ERR("\nGroup Symbol %i is undefined, set to 'U/A' !\n", i+1);
   7.339 +-            xkb->symbol_names[i] = strdup("U/A");
   7.340 ++            xkb->symbol_names[i] = g_strdup("U/A");
   7.341 +         }
   7.342 +     }
   7.343 + 
   7.344 ++    /* Create or recreate hash table.
   7.345 ++     * The layout that was associated to the windows may or may not be at the same group number,
   7.346 ++     * and worse, may no longer exist, which there is no meaningful way to deal with. */
   7.347 ++    if (xkb->group_hash_table != NULL)
   7.348 ++        g_hash_table_destroy(xkb->group_hash_table);
   7.349 ++    xkb->group_hash_table = g_hash_table_new(g_direct_hash, NULL);
   7.350 ++
   7.351 +     status = True;
   7.352 + 
   7.353 + HastaLaVista:
   7.354 +     if (kbd_desc_ptr != NULL)
   7.355 +         XkbFreeKeyboard(kbd_desc_ptr, 0, True);
   7.356 ++
   7.357 +     return status;
   7.358 + }
   7.359 + 
   7.360 ++/* GDK event filter that receives events from all windows and the Xkb extension. */
   7.361 ++static GdkFilterReturn xkb_event_filter(GdkXEvent * xevent, GdkEvent * event, XkbPlugin * xkb)
   7.362 ++{
   7.363 ++    XEvent * ev = (XEvent *) xevent;
   7.364 ++
   7.365 ++    if (ev->xany.type == xkb->base_event_code + XkbEventCode)
   7.366 ++    {
   7.367 ++        /* Xkb event. */
   7.368 ++        XkbEvent * xkbev = (XkbEvent *) ev;
   7.369 ++        if (xkbev->any.xkb_type == XkbNewKeyboardNotify)
   7.370 ++        {
   7.371 ++            initialize_keyboard_description(xkb);
   7.372 ++            refresh_group_xkb(xkb);
   7.373 ++            xkb_redraw(xkb);
   7.374 ++            xkb_enter_locale_by_process(xkb);
   7.375 ++        }
   7.376 ++        else if (xkbev->any.xkb_type == XkbStateNotify)
   7.377 ++        {
   7.378 ++            if (xkbev->state.group != xkb->current_group_xkb_no)
   7.379 ++            {
   7.380 ++                /* Switch to the new group and redraw the display. */
   7.381 ++                xkb->current_group_xkb_no = xkbev->state.group;
   7.382 ++                refresh_group_xkb(xkb);
   7.383 ++                xkb_redraw(xkb);
   7.384 ++                xkb_enter_locale_by_process(xkb);
   7.385 ++            }
   7.386 ++        }
   7.387 ++    }
   7.388 ++    return GDK_FILTER_CONTINUE;
   7.389 ++}
   7.390 ++
   7.391 + /* Initialize the Xkb interface. */
   7.392 + void xkb_mechanism_constructor(XkbPlugin * xkb)
   7.393 + {
   7.394 +-    /* Enable the Xkb extension on all clients. */
   7.395 +-    XkbIgnoreExtension(False);
   7.396 +-
   7.397 +-    /* Open the display. */
   7.398 +-    int major = XkbMajorVersion;
   7.399 +-    int minor = XkbMinorVersion;
   7.400 +-    char * display_name = "";
   7.401 +-    int event_code;
   7.402 +-    int error_rtrn;
   7.403 +-    int reason_rtrn;
   7.404 +-    xkb->dsp = XkbOpenDisplay(display_name, &event_code, &error_rtrn, &major, &minor, &reason_rtrn);
   7.405 +-
   7.406 +-    switch (reason_rtrn)
   7.407 ++    /* Initialize Xkb extension. */
   7.408 ++    int opcode;
   7.409 ++    int maj = XkbMajorVersion;
   7.410 ++    int min = XkbMinorVersion;
   7.411 ++    if ((XkbLibraryVersion(&maj, &min))
   7.412 ++    && (XkbQueryExtension(GDK_DISPLAY(), &opcode, &xkb->base_event_code, &xkb->base_error_code, &maj, &min)))
   7.413 +     {
   7.414 +-        case XkbOD_BadLibraryVersion:
   7.415 +-            ERR("Bad XKB library version.\n");
   7.416 +-            return;
   7.417 +-        case XkbOD_ConnectionRefused:
   7.418 +-            ERR("Connection to X server refused.\n");
   7.419 +-            return;
   7.420 +-        case XkbOD_BadServerVersion:
   7.421 +-            ERR("Bad X server version.\n");
   7.422 +-            return;
   7.423 +-        case XkbOD_NonXkbServer:
   7.424 +-            ERR("XKB not present.\n");
   7.425 +-            return;
   7.426 +-        case XkbOD_Success:
   7.427 +-            break;
   7.428 +-    }
   7.429 ++        /* Read the keyboard description. */
   7.430 ++        initialize_keyboard_description(xkb);
   7.431 + 
   7.432 +-    /* Initialize our mechanism. */
   7.433 +-    if (do_init_xkb(xkb) != True)
   7.434 +-        return;
   7.435 ++        /* Establish GDK event filter. */
   7.436 ++        gdk_window_add_filter(NULL, (GdkFilterFunc) xkb_event_filter, (gpointer) xkb);
   7.437 + 
   7.438 +-    /* Specify events we will receive. */
   7.439 +-    XkbSelectEventDetails(xkb->dsp, xkb->device_id, XkbStateNotify, XkbAllStateComponentsMask, XkbGroupStateMask);
   7.440 ++        /* Specify events we will receive. */
   7.441 ++        XkbSelectEvents(GDK_DISPLAY(), XkbUseCoreKbd, XkbNewKeyboardNotifyMask, XkbNewKeyboardNotifyMask);
   7.442 ++        XkbSelectEventDetails(GDK_DISPLAY(), XkbUseCoreKbd, XkbStateNotify, XkbAllStateComponentsMask, XkbGroupStateMask);
   7.443 + 
   7.444 +-    /* Get current state. */
   7.445 +-    refresh_group_xkb(xkb);
   7.446 ++        /* Get current state. */
   7.447 ++        refresh_group_xkb(xkb);
   7.448 ++    }
   7.449 + }
   7.450 + 
   7.451 + /* Deallocate resources associated with Xkb interface. */
   7.452 + void xkb_mechanism_destructor(XkbPlugin * xkb) 
   7.453 + {
   7.454 ++    /* Remove event filter. */
   7.455 ++    gdk_window_remove_filter(NULL, (GdkFilterFunc) xkb_event_filter, xkb);
   7.456 ++
   7.457 +     /* Free group and symbol name memory. */
   7.458 +     int i;
   7.459 +     for (i = 0; i < xkb->group_count; i++)
   7.460 +@@ -283,21 +319,11 @@ void xkb_mechanism_destructor(XkbPlugin * xkb)
   7.461 +         }
   7.462 +     }
   7.463 + 
   7.464 +-    /* Close the display. */
   7.465 +-    XCloseDisplay(xkb->dsp);
   7.466 +-    xkb->dsp = NULL;
   7.467 +-
   7.468 +     /* Destroy the hash table. */
   7.469 +     g_hash_table_destroy(xkb->group_hash_table);
   7.470 +     xkb->group_hash_table = NULL;
   7.471 + }
   7.472 + 
   7.473 +-/* Return the connection number for the display. */
   7.474 +-int xkb_get_connection_number(XkbPlugin * xkb)
   7.475 +-{
   7.476 +-    return ConnectionNumber(xkb->dsp);
   7.477 +-}
   7.478 +-
   7.479 + /* Set the layout to the next layout. */
   7.480 + int xkb_change_group(XkbPlugin * xkb, int increment) 
   7.481 + {
   7.482 +@@ -307,33 +333,13 @@ int xkb_change_group(XkbPlugin * xkb, int increment)
   7.483 +     if (next_group >= xkb->group_count) next_group = 0;
   7.484 + 
   7.485 +     /* Execute the change. */
   7.486 +-    XkbLockGroup(xkb->dsp, xkb->device_id, next_group);
   7.487 ++    XkbLockGroup(GDK_DISPLAY(), XkbUseCoreKbd, next_group);
   7.488 +     refresh_group_xkb(xkb);
   7.489 +     xkb_redraw(xkb);
   7.490 +     xkb_enter_locale_by_process(xkb);
   7.491 +     return 1;
   7.492 + }
   7.493 + 
   7.494 +-/* Callback when activity detected on the Xkb channel. */
   7.495 +-gboolean xkb_gio_callback(GIOChannel * source, GIOCondition condition, gpointer data) 
   7.496 +-{
   7.497 +-    XkbPlugin * xkb = (XkbPlugin *) data;
   7.498 +-
   7.499 +-    XkbEvent evnt;
   7.500 +-    XNextEvent(xkb->dsp, &evnt.core);
   7.501 +-    if ((evnt.type == xkb->base_event_code)
   7.502 +-    && (evnt.any.xkb_type == XkbStateNotify)
   7.503 +-    && (evnt.state.group != xkb->current_group_xkb_no))
   7.504 +-    {
   7.505 +-        /* Switch to the new group and redraw the display. */
   7.506 +-        xkb->current_group_xkb_no = evnt.state.group;
   7.507 +-        refresh_group_xkb(xkb);
   7.508 +-        xkb_redraw(xkb);
   7.509 +-        xkb_enter_locale_by_process(xkb);
   7.510 +-    }
   7.511 +-    return TRUE;
   7.512 +-}
   7.513 +-
   7.514 + /* React to change of focus by switching to the application's layout or the default layout. */
   7.515 + void xkb_active_window_changed(XkbPlugin * xkb, gint pid)
   7.516 + {
   7.517 +@@ -345,7 +351,7 @@ void xkb_active_window_changed(XkbPlugin * xkb, gint pid)
   7.518 + 
   7.519 +     if (new_group_xkb_no < xkb->group_count)
   7.520 +     {
   7.521 +-        XkbLockGroup(xkb->dsp, xkb->device_id, new_group_xkb_no);
   7.522 ++        XkbLockGroup(GDK_DISPLAY(), XkbUseCoreKbd, new_group_xkb_no);
   7.523 +         refresh_group_xkb(xkb);
   7.524 +     }
   7.525 + }
   7.526 +diff --git a/src/plugins/xkb/xkb.h b/src/plugins/xkb/xkb.h
   7.527 +index 9265198..20c7ed3 100644
   7.528 +--- a/src/plugins/xkb/xkb.h
   7.529 ++++ b/src/plugins/xkb/xkb.h
   7.530 +@@ -49,10 +49,8 @@ typedef struct {
   7.531 +     GtkWidget * per_app_default_layout_menu;	/* Combo box of all available layouts */
   7.532 + 
   7.533 +     /* Mechanism. */
   7.534 +-    Display * dsp;				/* Handle to X display */
   7.535 +     int base_event_code;			/* Result of initializing Xkb extension */
   7.536 +     int base_error_code;
   7.537 +-    int device_id;				/* Keyboard device ID (always "core keyboard") */
   7.538 +     int current_group_xkb_no;			/* Current layout */
   7.539 +     int group_count;				/* Count of groups as returned by Xkb */
   7.540 +     char * group_names[XkbNumKbdGroups];	/* Group names as returned by Xkb */
   7.541 +@@ -67,12 +65,11 @@ extern int xkb_get_current_group_xkb_no(XkbPlugin * xkb);
   7.542 + extern int xkb_get_group_count(XkbPlugin * xkb);
   7.543 + extern const char * xkb_get_symbol_name_by_res_no(XkbPlugin * xkb, int group_res_no);
   7.544 + extern const char * xkb_get_current_group_name(XkbPlugin * xkb);
   7.545 +-extern const char * xkb_get_current_group_name_lowercase(XkbPlugin * xkb);
   7.546 ++extern const char * xkb_get_current_symbol_name(XkbPlugin * xkb);
   7.547 ++extern const char * xkb_get_current_symbol_name_lowercase(XkbPlugin * xkb);
   7.548 + extern void xkb_mechanism_constructor(XkbPlugin * xkb);
   7.549 + extern void xkb_mechanism_destructor(XkbPlugin * xkb);
   7.550 +-extern int xkb_get_connection_number(XkbPlugin * xkb);
   7.551 + extern int xkb_change_group(XkbPlugin * xkb, int increment);
   7.552 +-extern gboolean xkb_gio_callback(GIOChannel * source, GIOCondition condition, gpointer data);
   7.553 + extern void xkb_active_window_changed(XkbPlugin * xkb, GPid pid);
   7.554 + 
   7.555 + #endif
   7.556 +-- 
   7.557 +1.7.0
   7.558 +