Rename panel, plugin, and plugin_class to Panel, Plugin, and
authorHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Sat, 5 Apr 2008 17:42:16 +0000 (17:42 +0000)
committerHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Sat, 5 Apr 2008 17:42:16 +0000 (17:42 +0000)
PluginClass.
Port xkb plugin from xfce4-panel. (Not finished, currently broken).
Some little fixes.

111 files changed:
configure.ac
src/configurator.c
src/ev.c
src/ev.h
src/gtk-run.c
src/misc.c
src/misc.h
src/panel.c
src/panel.h
src/plugin.c
src/plugin.h
src/plugins/batt/batt.c
src/plugins/cpu/cpu.c
src/plugins/dclock.c
src/plugins/deskno/deskno.c
src/plugins/deskno/deskno2.c
src/plugins/dirmenu.c
src/plugins/image.c
src/plugins/launchbar.c
src/plugins/menu.c
src/plugins/netstat/netstat.c
src/plugins/netstatus/netstatus.c
src/plugins/pager.c
src/plugins/separator.c
src/plugins/space.c
src/plugins/taskbar.c
src/plugins/test.c
src/plugins/volume/volume.c
src/plugins/volumealsa/volumealsa.c
src/plugins/wincmd.c
src/plugins/xkb/Makefile.am [new file with mode: 0644]
src/plugins/xkb/flags/Makefile.am [new file with mode: 0644]
src/plugins/xkb/flags/Makefile.in [new file with mode: 0644]
src/plugins/xkb/flags/ae.png [new file with mode: 0644]
src/plugins/xkb/flags/am.png [new file with mode: 0644]
src/plugins/xkb/flags/ar.png [new file with mode: 0644]
src/plugins/xkb/flags/at.png [new file with mode: 0644]
src/plugins/xkb/flags/az.png [new file with mode: 0644]
src/plugins/xkb/flags/be.png [new file with mode: 0644]
src/plugins/xkb/flags/bg.png [new file with mode: 0644]
src/plugins/xkb/flags/bh.png [new file with mode: 0644]
src/plugins/xkb/flags/br.png [new file with mode: 0644]
src/plugins/xkb/flags/by.png [new file with mode: 0644]
src/plugins/xkb/flags/ca.png [new file with mode: 0644]
src/plugins/xkb/flags/ch.png [new file with mode: 0644]
src/plugins/xkb/flags/cu.png [new file with mode: 0644]
src/plugins/xkb/flags/cz.png [new file with mode: 0644]
src/plugins/xkb/flags/de.png [new file with mode: 0644]
src/plugins/xkb/flags/dj.png [new file with mode: 0644]
src/plugins/xkb/flags/dk.png [new file with mode: 0644]
src/plugins/xkb/flags/dz.png [new file with mode: 0644]
src/plugins/xkb/flags/ee.png [new file with mode: 0644]
src/plugins/xkb/flags/eg.png [new file with mode: 0644]
src/plugins/xkb/flags/es.png [new file with mode: 0644]
src/plugins/xkb/flags/eu.png [new file with mode: 0644]
src/plugins/xkb/flags/fi.png [new file with mode: 0644]
src/plugins/xkb/flags/fr.png [new file with mode: 0644]
src/plugins/xkb/flags/ge.png [new file with mode: 0644]
src/plugins/xkb/flags/gr.png [new file with mode: 0644]
src/plugins/xkb/flags/hr.png [new file with mode: 0644]
src/plugins/xkb/flags/hu.png [new file with mode: 0644]
src/plugins/xkb/flags/il.png [new file with mode: 0644]
src/plugins/xkb/flags/iq.png [new file with mode: 0644]
src/plugins/xkb/flags/is.png [new file with mode: 0644]
src/plugins/xkb/flags/it.png [new file with mode: 0644]
src/plugins/xkb/flags/jo.png [new file with mode: 0644]
src/plugins/xkb/flags/jp.png [new file with mode: 0644]
src/plugins/xkb/flags/km.png [new file with mode: 0644]
src/plugins/xkb/flags/kr.png [new file with mode: 0644]
src/plugins/xkb/flags/kw.png [new file with mode: 0644]
src/plugins/xkb/flags/la.png [new file with mode: 0644]
src/plugins/xkb/flags/lb.png [new file with mode: 0644]
src/plugins/xkb/flags/lt.png [new file with mode: 0644]
src/plugins/xkb/flags/ly.png [new file with mode: 0644]
src/plugins/xkb/flags/ma.png [new file with mode: 0644]
src/plugins/xkb/flags/mk.png [new file with mode: 0644]
src/plugins/xkb/flags/mn.png [new file with mode: 0644]
src/plugins/xkb/flags/mx.png [new file with mode: 0644]
src/plugins/xkb/flags/nl.png [new file with mode: 0644]
src/plugins/xkb/flags/no.png [new file with mode: 0644]
src/plugins/xkb/flags/om.png [new file with mode: 0644]
src/plugins/xkb/flags/pl.png [new file with mode: 0644]
src/plugins/xkb/flags/ps.png [new file with mode: 0644]
src/plugins/xkb/flags/pt.png [new file with mode: 0644]
src/plugins/xkb/flags/qa.png [new file with mode: 0644]
src/plugins/xkb/flags/qc.png [new file with mode: 0644]
src/plugins/xkb/flags/ro.png [new file with mode: 0644]
src/plugins/xkb/flags/ru.png [new file with mode: 0644]
src/plugins/xkb/flags/sa.png [new file with mode: 0644]
src/plugins/xkb/flags/sd.png [new file with mode: 0644]
src/plugins/xkb/flags/se.png [new file with mode: 0644]
src/plugins/xkb/flags/si.png [new file with mode: 0644]
src/plugins/xkb/flags/sk.png [new file with mode: 0644]
src/plugins/xkb/flags/so.png [new file with mode: 0644]
src/plugins/xkb/flags/sr.png [new file with mode: 0644]
src/plugins/xkb/flags/sy.png [new file with mode: 0644]
src/plugins/xkb/flags/th.png [new file with mode: 0644]
src/plugins/xkb/flags/tn.png [new file with mode: 0644]
src/plugins/xkb/flags/tr.png [new file with mode: 0644]
src/plugins/xkb/flags/ua.png [new file with mode: 0644]
src/plugins/xkb/flags/uk.png [new file with mode: 0644]
src/plugins/xkb/flags/un.png [new file with mode: 0644]
src/plugins/xkb/flags/us.png [new file with mode: 0644]
src/plugins/xkb/flags/uy.png [new file with mode: 0644]
src/plugins/xkb/flags/vn.png [new file with mode: 0644]
src/plugins/xkb/flags/ye.png [new file with mode: 0644]
src/plugins/xkb/flags/yu.png [new file with mode: 0644]
src/plugins/xkb/xkb-plugin.c [new file with mode: 0644]
src/plugins/xkb/xkb.c [new file with mode: 0644]
src/plugins/xkb/xkb.h [new file with mode: 0644]
src/systray/tray.c

index 30f340d..6da8aad 100644 (file)
@@ -145,6 +145,7 @@ plugin_volumealsa=
 plugin_cpu=
 plugin_deskno=
 plugin_batt=
+plugin_xkb=
 
 AC_MSG_CHECKING([which plugins should be built dynamically])
 AC_ARG_WITH(plugins,
@@ -152,7 +153,7 @@ AC_ARG_WITH(plugins,
 [                         plugins may be comma separated ]
 [                         'all' builds all plugins (default), 'none' builds none ]
 [                         Possible plugins are: ]
-[                         netstatus, netstat, volume, volumealsa, cpu, deskno, batt], plugins="$withval",[plugins="all"])
+[                         netstatus, netstat, volume, volumealsa, cpu, deskno, batt, xkb], plugins="$withval",[plugins="all"])
 
 if test x"$plugins" != xall -a x"$plugins" != xnone; then
     if test x"$plugins_loading" = xno; then
@@ -161,7 +162,7 @@ if test x"$plugins" != xall -a x"$plugins" != xnone; then
     fi
 fi
 
-ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt"
+ALL_PLUGINS_LIST="netstatus netstat volume volumealsa cpu deskno batt xkb"
 AC_SUBST(ALL_PLUGINS_LIST)
 
 if test x"$plugins" = xall; then
@@ -177,6 +178,7 @@ dnl    done
     plugin_cpu=cpu
     plugin_deskno=deskno
     plugin_batt=batt
+    plugin_xkb=xkb
 
     AC_MSG_RESULT(all)
 else
@@ -204,7 +206,10 @@ else
                 plugin_deskno=deskno
                 ;;
             batt)
-                plugin_deskno=batt
+                plugin_batt=batt
+                ;;
+            xkb)
+                plugin_xkb=xkb
                 ;;
             *)
                 echo "Unknown plugin $plugin."
@@ -232,7 +237,16 @@ if test x"$compile_libiw" = "xno"; then
    fi
    plugin_netstat=
 fi
-PLUGINS_LIST="$plugin_netstatus $plugin_netstat $plugin_volume $plugin_volumealsa $plugin_cpu $plugin_deskno $plugin_batt"
+PLUGINS_LIST="\
+       $plugin_netstatus \
+       $plugin_netstat \
+       $plugin_volume \
+       $plugin_volumealsa \
+       $plugin_cpu \
+       $plugin_deskno \
+       $plugin_batt \
+       $plugin_xkb"
+
 AC_SUBST(PLUGINS_LIST)
 
 
@@ -277,6 +291,7 @@ AC_CONFIG_FILES([
     src/plugins/cpu/Makefile
     src/plugins/deskno/Makefile
     src/plugins/batt/Makefile
+    src/plugins/xkb/Makefile
     po/Makefile.in
     data/Makefile
     data/default/config
@@ -311,6 +326,9 @@ echo Building dynamic plugins:
     if test x"$plugin_batt" != x; then
         AC_MSG_RESULT([    batt - Monitor battery status])
     fi
+    if test x"$plugin_xkb" != x; then
+        AC_MSG_RESULT([    xkb - Keyboard layout switcher])
+    fi
 else
 echo Dynamic loader for plugins....... : disabled.
 fi
index ed41663..0fac137 100644 (file)
@@ -40,7 +40,7 @@ void gtk_run(void);
 void config_save(void);
 static void logout(void);
 
-command commands[] = {
+Command commands[] = {
     { "configure", N_("Preferences"), configure },
     { "run", N_("Run"), gtk_run },
     { "restart", N_("Restart"), restart },
@@ -78,7 +78,7 @@ static GtkWidget *bg_checkdis, *bg_checkb, *bg_selfileb;
 //properties
 static GtkWidget *prop_dt_checkb, *prop_st_checkb;
 
-extern panel *p;
+extern Panel *p;       /* FIXME: Should support multiple panels */
 extern gchar *cprofile;
 extern int config;
 extern FILE *pconf;
@@ -720,7 +720,7 @@ on_sel_plugin_changed( GtkTreeSelection* tree_sel, GtkWidget* label )
 {
     GtkTreeIter it;
     GtkTreeModel* model;
-    plugin* pl;
+    Plugin* pl;
 
     if( gtk_tree_selection_get_selected( tree_sel, &model, &it ) )
     {
@@ -752,7 +752,7 @@ static void init_plugin_list( GtkTreeView* view, GtkWidget* label )
     for( l = p->plugins; l; l = l->next )
     {
         GtkTreeIter it;
-        plugin* pl = (plugin*)l->data;
+        Plugin* pl = (Plugin*)l->data;
         gtk_list_store_append( list, &it );
         gtk_list_store_set( list, &it,
                             0, _(pl->class->name),
@@ -785,7 +785,7 @@ static void on_add_plugin_response( GtkDialog* dlg,
         if( gtk_tree_selection_get_selected( tree_sel, &model, &it ) )
         {
             char* type = NULL;
-            plugin* pl;
+            Plugin* pl;
             gtk_tree_model_get( model, &it, 1, &type, -1 );
             if( pl = plugin_load( type ) )
             {
@@ -870,7 +870,7 @@ static void on_add_plugin( GtkButton* btn, GtkTreeView* _view )
                                G_TYPE_STRING );
 
     for( tmp = classes; tmp; tmp = tmp->next ) {
-        plugin_class* pc = (plugin_class*)tmp->data;
+        PluginClass* pc = (PluginClass*)tmp->data;
         if( ! pc->invisible ) {
             /* FIXME: should we display invisible plugins? */
             GtkTreeIter it;
@@ -900,7 +900,7 @@ static void on_remove_plugin( GtkButton* btn, GtkTreeView* view )
     GtkTreePath* tree_path;
     GtkTreeModel* model;
     GtkTreeSelection* tree_sel = gtk_tree_view_get_selection( view );
-    plugin* pl;
+    Plugin* pl;
 
     if( gtk_tree_selection_get_selected( tree_sel, &model, &it ) )
     {
@@ -923,7 +923,7 @@ void modify_plugin( GtkTreeView* view )
     GtkTreeSelection* tree_sel = gtk_tree_view_get_selection( view );
     GtkTreeModel* model;
     GtkTreeIter it;
-    plugin* pl;
+    Plugin* pl;
 
     if( ! gtk_tree_selection_get_selected( tree_sel, &model, &it ) )
         return;
@@ -933,13 +933,13 @@ void modify_plugin( GtkTreeView* view )
         pl->class->config( pl, (GtkWindow*)gtk_widget_get_toplevel(GTK_WIDGET(view)) );
 }
 
-static int get_widget_index( plugin* pl )
+static int get_widget_index( Plugin* pl )
 {
     GList* l;
     int i;
     for( i = 0, l = p->plugins; l; l = l->next )
     {
-        plugin* _pl = (plugin*)l->data;
+        Plugin* _pl = (Plugin*)l->data;
         if( _pl == pl )
             return i;
         if( _pl->pwid )
@@ -963,7 +963,7 @@ static void on_moveup_plugin(  GtkButton* btn, GtkTreeView* view )
     do{
         if( gtk_tree_selection_iter_is_selected(tree_sel, &it) )
         {
-            plugin* pl;
+            Plugin* pl;
             gtk_tree_model_get( model, &it, 1, &pl, -1 );
             gtk_list_store_move_before( GTK_LIST_STORE( model ),
                                         &it, &prev );
@@ -993,7 +993,7 @@ static void on_movedown_plugin(  GtkButton* btn, GtkTreeView* view )
     GtkTreeIter it, next;
     GtkTreeModel* model;
     GtkTreeSelection* tree_sel = gtk_tree_view_get_selection( view );
-    plugin* pl;
+    Plugin* pl;
     int i;
 
     if( ! gtk_tree_selection_get_selected( tree_sel, &model, &it ) )
@@ -1337,7 +1337,7 @@ plugin_config_save(FILE *fp)
     GList* l;
     for( l = p->plugins; l; l = l->next )
     {
-        plugin* pl = (plugin*)l->data;
+        Plugin* pl = (Plugin*)l->data;
         lxpanel_put_line( fp, "Plugin {" );
         lxpanel_put_line( fp, "type = %s", pl->class->type );
         if( pl->expand )
index 723ea0c..ba0ca99 100644 (file)
--- a/src/ev.c
+++ b/src/ev.c
@@ -38,7 +38,6 @@
 #include "dbg.h"
 
 
-
 struct _FbEvClass {
     GObjectClass   parent_class;
     void *dummy;
@@ -145,6 +144,14 @@ fb_ev_class_init (FbEvClass *klass)
               NULL, NULL,
               g_cclosure_marshal_VOID__VOID,
               G_TYPE_NONE, 0);
+    signals [EV_DESTROY_WINDOW] = 
+        g_signal_new ("destroy_window",
+              G_OBJECT_CLASS_TYPE (object_class),
+              G_SIGNAL_RUN_FIRST,
+              G_STRUCT_OFFSET (FbEvClass, active_window),
+              NULL, NULL,
+              g_cclosure_marshal_VOID__POINTER,
+              G_TYPE_NONE, 1, G_TYPE_POINTER);
     signals [EV_CLIENT_LIST_STACKING] = 
         g_signal_new ("client_list_stacking",
               G_OBJECT_CLASS_TYPE (object_class),
@@ -198,14 +205,30 @@ fb_ev_finalize (GObject *object)
 }
 
 void
-fb_ev_trigger(FbEv *ev, int signal)
+fb_ev_emit(FbEv *ev, int signal)
 {
     DBG("signal=%d\n", signal);
     g_assert(signal >=0 && signal < LAST_SIGNAL);
     DBG("\n");
+    if( signal == EV_ACTIVE_WINDOW )
+    {
+       Window* win = None;
+               ev->active_window = None;
+               win = (Window*)get_xaproperty (GDK_ROOT_WINDOW(), a_NET_ACTIVE_WINDOW, XA_WINDOW, 0);
+               if (win) {
+                       ev->active_window = *win;
+                       g_debug( "WIN: %p", *win );
+                       XFree (win);
+               }
+    }
     g_signal_emit(ev, signals [signal], 0);
 }
 
+void fb_ev_emit_destroy(FbEv *ev, Window win)
+{
+    g_signal_emit(ev, signals [EV_DESTROY_WINDOW], 0, win );   
+}
+
 static void
 ev_current_desktop(FbEv *ev, gpointer p)
 {
@@ -297,6 +320,18 @@ fb_ev_number_of_desktops(FbEv *ev)
 
 }
 
-Window fb_ev_active_window(FbEv *ev);
-Window *fb_ev_client_list(FbEv *ev);
-Window *fb_ev_client_list_stacking(FbEv *ev);
+Window *fb_ev_active_window(FbEv *ev)
+{
+       return ev->active_window;       
+}
+
+Window *fb_ev_client_list(FbEv *ev)
+{
+       return ev->client_list;
+}
+
+Window *fb_ev_client_list_stacking(FbEv *ev)
+{
+       return ev->client_list_stacking;
+}
+
index df779c4..4a9b935 100644 (file)
--- a/src/ev.h
+++ b/src/ev.h
@@ -35,6 +35,7 @@
 #include <glib.h>
 #include <glib-object.h>
 #include <gtk/gtk.h>
+#include <gdk/gdkx.h>
 
 #define FB_TYPE_EV         (fb_ev_get_type ())
 #define FB_EV(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o),      \
@@ -58,6 +59,7 @@ enum {
     EV_NUMBER_OF_DESKTOPS,
     EV_DESKTOP_NAMES,
     EV_ACTIVE_WINDOW,
+    EV_DESTROY_WINDOW,
     EV_CLIENT_LIST_STACKING,
     EV_CLIENT_LIST,
     LAST_SIGNAL
@@ -66,14 +68,14 @@ enum {
 GType fb_ev_get_type       (void);
 FbEv *fb_ev_new(void);
 void fb_ev_notify_changed_ev(FbEv *ev);
-void fb_ev_trigger(FbEv *ev, int signal);
+void fb_ev_emit(FbEv *ev, int signal);
+void fb_ev_emit_destroy(FbEv *ev, Window win);
 
-
-int fb_ev_current_desktop(FbEv *ev);
-int fb_ev_number_of_desktops(FbEv *ev);
-Window fb_ev_active_window(FbEv *ev);
-Window *fb_ev_client_list(FbEv *ev);
-Window *fb_ev_client_list_stacking(FbEv *ev);
+extern int fb_ev_current_desktop(FbEv *ev);
+extern int fb_ev_number_of_desktops(FbEv *ev);
+extern Window *fb_ev_active_window(FbEv *ev);
+extern Window *fb_ev_client_list(FbEv *ev);
+extern Window *fb_ev_client_list_stacking(FbEv *ev);
 
 
 #endif /* __FB_EV_H__ */
index 5e21fa2..08774b7 100644 (file)
@@ -22,7 +22,7 @@
 #include <string.h>
 #include "misc.h"
 
-extern panel *p;
+extern Panel *p;       /* FIXME: this should be removed */
 
 static gboolean setup_auto_complete( gpointer entry )
 {
index 900ebe6..58b0279 100644 (file)
@@ -56,7 +56,6 @@ Atom a_NET_DESKTOP_NAMES;
 Atom a_NET_ACTIVE_WINDOW;
 Atom a_NET_CLOSE_WINDOW;
 Atom a_NET_SUPPORTED;
-Atom a_NET_WM_DESKTOP;
 Atom a_NET_WM_STATE;
 Atom a_NET_WM_STATE_SKIP_TASKBAR;
 Atom a_NET_WM_STATE_SKIP_PAGER;
@@ -73,6 +72,7 @@ Atom a_NET_WM_WINDOW_TYPE_SPLASH;
 Atom a_NET_WM_WINDOW_TYPE_DIALOG;
 Atom a_NET_WM_WINDOW_TYPE_NORMAL;
 Atom a_NET_WM_DESKTOP;
+Atom a_NET_WM_PID;
 Atom a_NET_WM_NAME;
 Atom a_NET_WM_VISIBLE_NAME;
 Atom a_NET_WM_STRUT;
@@ -115,6 +115,7 @@ enum{
     I_NET_WM_WINDOW_TYPE_DIALOG,
     I_NET_WM_WINDOW_TYPE_NORMAL,
     I_NET_WM_DESKTOP,
+    I_NET_WM_PID,
     I_NET_WM_NAME,
     I_NET_WM_VISIBLE_NAME,
     I_NET_WM_STRUT,
@@ -303,13 +304,13 @@ lxpanel_get_line(char**fp, line *s)
 }
 
 extern const char*
-lxpanel_get_file_manager( panel *p )
+lxpanel_get_file_manager( Panel *p )
 {
     return p->file_manager ? p->file_manager : "pcmanfm %";
 }
 
 extern const char*
-lxpanel_get_terminal( panel *p )
+lxpanel_get_terminal( Panel *p )
 {
     return p->terminal ? p->terminal : "x-terminal-emulator";
 }
@@ -386,6 +387,7 @@ void resolve_atoms()
     atom_names[ I_NET_WM_WINDOW_TYPE_DIALOG ] = "_NET_WM_WINDOW_TYPE_DIALOG";
     atom_names[ I_NET_WM_WINDOW_TYPE_NORMAL ] = "_NET_WM_WINDOW_TYPE_NORMAL";
     atom_names[ I_NET_WM_DESKTOP ] = "_NET_WM_DESKTOP";
+    atom_names[ I_NET_WM_PID ] = "_NET_WM_PID";
     atom_names[ I_NET_WM_NAME ] = "_NET_WM_NAME";
     atom_names[ I_NET_WM_VISIBLE_NAME ] = "_NET_WM_VISIBLE_NAME";
     atom_names[ I_NET_WM_STRUT ] = "_NET_WM_STRUT";
@@ -418,7 +420,6 @@ void resolve_atoms()
     a_NET_DESKTOP_NAMES = atoms[ I_NET_DESKTOP_NAMES ];
     a_NET_ACTIVE_WINDOW = atoms[ I_NET_ACTIVE_WINDOW ];
     a_NET_SUPPORTED = atoms[ I_NET_SUPPORTED ];
-    a_NET_WM_DESKTOP = atoms[ I_NET_WM_DESKTOP ];
     a_NET_WM_STATE = atoms[ I_NET_WM_STATE ];
     a_NET_WM_STATE_SKIP_TASKBAR = atoms[ I_NET_WM_STATE_SKIP_TASKBAR ];
     a_NET_WM_STATE_SKIP_PAGER = atoms[ I_NET_WM_STATE_SKIP_PAGER ];
@@ -682,8 +683,23 @@ get_net_wm_desktop(Window win)
     RET(desk);
 }
 
+GPid
+get_net_wm_pid(Window win)
+{
+    GPid pid = 0;
+    guint32 *data;
+
+    ENTER;
+    data = get_xaproperty (win, a_NET_WM_PID, XA_CARDINAL, 0);
+    if (data) {
+        pid = *data;
+        XFree (data);
+    }
+    RET(pid);
+}
+
 void
-get_net_wm_state(Window win, net_wm_state *nws)
+get_net_wm_state(Window win, NetWMState *nws)
 {
     Atom *state;
     int num3;
@@ -724,7 +740,7 @@ get_net_wm_state(Window win, net_wm_state *nws)
 
 
 void
-get_net_wm_window_type(Window win, net_wm_window_type *nwwt)
+get_net_wm_window_type(Window win, NetWMWindowType *nwwt)
 {
     Atom *state;
     int num3;
@@ -831,7 +847,7 @@ calculate_width(int scrw, int wtype, int allign, int margin,
 
 
 void
-calculate_position(panel *np)
+calculate_position(Panel *np)
 {
     int sswidth, ssheight, minx, miny;
 
index 555691c..3577896 100644 (file)
@@ -50,8 +50,8 @@ extern pair pos_pair[];
 
 int str2num(pair *p, gchar *str, int defval);
 gchar *num2str(pair *p, int num, gchar *defval);
-extern const char* lxpanel_get_file_manager( panel *p );
-extern const char* lxpanel_get_terminal( panel *p );
+extern const char* lxpanel_get_file_manager( Panel *p );
+extern const char* lxpanel_get_terminal( Panel *p );
 
 extern int lxpanel_get_line(char **fp, line *s);
 extern int lxpanel_put_line(FILE* fp, const char* format, ...);
@@ -73,10 +73,11 @@ int get_net_number_of_desktops();
 int get_net_current_desktop ();
 int get_net_wm_desktop(Window win);
 int get_wm_state (Window win);
-void get_net_wm_state(Window win, net_wm_state *nws);
-void get_net_wm_window_type(Window win, net_wm_window_type *nwwt);
+void get_net_wm_state(Window win, NetWMState *nws);
+void get_net_wm_window_type(Window win, NetWMWindowType *nwwt);
+GPid get_net_wm_pid(Window win);
 
-void calculate_position(panel *np);
+void calculate_position(Panel *np);
 gchar *expand_tilda(gchar *file);
 GdkPixbuf *gdk_pixbuf_scale_ratio(GdkPixbuf *p, int width, int height, GdkInterpType itype,
                                   gboolean keep_ratio);
index 6c4c495..ada995f 100644 (file)
@@ -43,13 +43,13 @@ static gchar version[] = VERSION;
 gchar *cprofile = "default";
 
 static int config = 0;
-FbEv *fbev;
+FbEv *fbev = NULL;
 
 //#define DEBUG
 #include "dbg.h"
 
 int log_level;
-panel *p;
+Panel *p;      /* FIXME: This should be removed!!! */
 
 gboolean is_restarting = FALSE;
 
@@ -58,7 +58,7 @@ gboolean is_restarting = FALSE;
  ****************************************************/
 /*
 static void
-panel_del_wm_strut(panel *p)
+panel_del_wm_strut(Panel *p)
 {
     XDeleteProperty(GDK_DISPLAY(), p->topxwin, a_NET_WM_STRUT);
     XDeleteProperty(GDK_DISPLAY(), p->topxwin, a_NET_WM_STRUT_PARTIAL);
@@ -66,7 +66,7 @@ panel_del_wm_strut(panel *p)
 */
 
 
-void panel_set_wm_strut(panel *p)
+void panel_set_wm_strut(Panel *p)
 {
     gulong data[12] = { 0 };
     int i = 4;
@@ -124,7 +124,7 @@ void panel_set_wm_strut(panel *p)
 }
 
 static void
-print_wmdata(panel *p)
+print_wmdata(Panel *p)
 {
     int i;
 
@@ -150,7 +150,7 @@ void configure(void);
 void restart(void);
 void gtk_run(void);
 
-static void process_client_msg ( panel *p, XClientMessageEvent* ev )
+static void process_client_msg ( Panel *p, XClientMessageEvent* ev )
 {
     int cmd = ev->data.b[0];
     switch( cmd )
@@ -181,7 +181,7 @@ static void process_client_msg ( panel *p, XClientMessageEvent* ev )
 }
 
 static GdkFilterReturn
-panel_event_filter(GdkXEvent *xevent, GdkEvent *event, panel *p)
+panel_event_filter(GdkXEvent *xevent, GdkEvent *event, Panel *p)
 {
     Atom at;
     Window win;
@@ -195,6 +195,10 @@ panel_event_filter(GdkXEvent *xevent, GdkEvent *event, panel *p)
         {
             process_client_msg( p, (XClientMessageEvent*)ev );
         }
+        else if( ev->type == DestroyNotify )
+        {
+               fb_ev_emit_destroy( fbev, ((XDestroyWindowEvent*)ev)->window );
+        }
         RET(GDK_FILTER_CONTINUE);
     }
 
@@ -204,24 +208,24 @@ panel_event_filter(GdkXEvent *xevent, GdkEvent *event, panel *p)
     if (win == GDK_ROOT_WINDOW()) {
     if (at == a_NET_CLIENT_LIST) {
             DBG("A_NET_CLIENT_LIST\n");
-            fb_ev_trigger(fbev, EV_CLIENT_LIST);
+            fb_ev_emit(fbev, EV_CLIENT_LIST);
     } else if (at == a_NET_CURRENT_DESKTOP) {
             DBG("A_NET_CURRENT_DESKTOP\n");
             p->curdesk = get_net_current_desktop();
-            fb_ev_trigger(fbev, EV_CURRENT_DESKTOP);
+            fb_ev_emit(fbev, EV_CURRENT_DESKTOP);
     } else if (at == a_NET_NUMBER_OF_DESKTOPS) {
             DBG("A_NET_NUMBER_OF_DESKTOPS\n");
             p->desknum = get_net_number_of_desktops();
-            fb_ev_trigger(fbev, EV_NUMBER_OF_DESKTOPS);
+            fb_ev_emit(fbev, EV_NUMBER_OF_DESKTOPS);
     } else if (at == a_NET_DESKTOP_NAMES) {
             DBG("A_NET_DESKTOP_NAMES\n");
-            fb_ev_trigger(fbev, EV_DESKTOP_NAMES);
+            fb_ev_emit(fbev, EV_DESKTOP_NAMES);
         } else if (at == a_NET_ACTIVE_WINDOW) {
             DBG("A_NET_ACTIVE_WINDOW\n");
-            fb_ev_trigger(fbev, EV_ACTIVE_WINDOW);
+            fb_ev_emit(fbev, EV_ACTIVE_WINDOW );
         }else if (at == a_NET_CLIENT_LIST_STACKING) {
             DBG("A_NET_CLIENT_LIST_STACKING\n");
-            fb_ev_trigger(fbev, EV_CLIENT_LIST_STACKING);
+            fb_ev_emit(fbev, EV_CLIENT_LIST_STACKING);
         } else if (at == a_XROOTPMAP_ID) {
             DBG("a_XROOTPMAP_ID\n");
             if (p->transparent) {
@@ -255,20 +259,20 @@ panel_delete_event(GtkWidget * widget, GdkEvent * event, gpointer data)
 static gint
 panel_destroy_event(GtkWidget * widget, GdkEvent * event, gpointer data)
 {
-    //panel *p = (panel *) data;
+    //Panel *p = (Panel *) data;
     //if (!p->self_destroy)
     gtk_main_quit();
     RET(FALSE);
 }
 
 static void
-on_root_bg_changed(FbBg *bg, panel* p)
+on_root_bg_changed(FbBg *bg, Panel* p)
 {
     panel_update_background( p );
 }
 
 /* This function should only be called after the panel has been realized */
-void panel_update_background( panel* p )
+void panel_update_background( Panel* p )
 {
     GList* l;
     GdkPixmap* pixmap = NULL;
@@ -320,7 +324,7 @@ void panel_update_background( panel* p )
 
     for( l = p->plugins; l; l = l->next )
     {
-        plugin* pl = (plugin*)l->data;
+        Plugin* pl = (Plugin*)l->data;
         plugin_set_background( pl, p );
     }
 
@@ -329,13 +333,13 @@ void panel_update_background( panel* p )
 }
 
 static void
-panel_realize(GtkWidget *widget, panel *p)
+panel_realize(GtkWidget *widget, Panel *p)
 {
 
 }
 
 static gint
-panel_size_req(GtkWidget *widget, GtkRequisition *req, panel *p)
+panel_size_req(GtkWidget *widget, GtkRequisition *req, Panel *p)
 {
     ENTER;
 
@@ -351,7 +355,7 @@ panel_size_req(GtkWidget *widget, GtkRequisition *req, panel *p)
 }
 
 static gint
-panel_size_alloc(GtkWidget *widget, GtkAllocation *a, panel *p)
+panel_size_alloc(GtkWidget *widget, GtkAllocation *a, Panel *p)
 {
     ENTER;
     if (p->widthtype == WIDTH_REQUEST)
@@ -371,7 +375,7 @@ panel_size_alloc(GtkWidget *widget, GtkAllocation *a, panel *p)
 
 
 static  gboolean
-panel_configure_event (GtkWidget *widget, GdkEventConfigure *e, panel *p)
+panel_configure_event (GtkWidget *widget, GdkEventConfigure *e, Panel *p)
 {
     ENTER;
     if (e->width == p->cw && e->height == p->ch && e->x == p->cx && e->y == p->cy)
@@ -392,13 +396,13 @@ panel_configure_event (GtkWidget *widget, GdkEventConfigure *e, panel *p)
  *         panel creation                           *
  ****************************************************/
 static void
-make_round_corners(panel *p)
+make_round_corners(Panel *p)
 {
     /* FIXME: This should be re-written with shape extension of X11 */
     /* gdk_window_shape_combine_mask() can be used */
 }
 
-void panel_set_dock_type(panel *p)
+void panel_set_dock_type(Panel *p)
 {
     if (p->setdocktype) {
         Atom state = a_NET_WM_WINDOW_TYPE_DOCK;
@@ -412,7 +416,7 @@ void panel_set_dock_type(panel *p)
 }
 
 static void
-panel_start_gui(panel *p)
+panel_start_gui(Panel *p)
 {
     Atom state[3];
     XWMHints wmhints;
@@ -505,7 +509,7 @@ panel_start_gui(panel *p)
     RET();
 }
 
-void panel_set_orientation(panel *p)
+void panel_set_orientation(Panel *p)
 {
     GList* l;
     p->orientation = (p->edge == EDGE_TOP || p->edge == EDGE_BOTTOM)
@@ -532,7 +536,7 @@ void panel_set_orientation(panel *p)
        from the config dialog, and plugins should be re-layout.
     */
     for( l = p->plugins; l; l = l->next ) {
-        plugin* pl = (plugin*)l->data;
+        Plugin* pl = (Plugin*)l->data;
         if( pl->class->orientation ) {
             pl->class->orientation( pl );
         }
@@ -540,7 +544,7 @@ void panel_set_orientation(panel *p)
 }
 
 static int
-panel_parse_global(panel *p, char **fp)
+panel_parse_global(Panel *p, char **fp)
 {
     line s;
     s.len = 256;
@@ -636,10 +640,10 @@ panel_parse_global(panel *p, char **fp)
 }
 
 static int
-panel_parse_plugin(panel *p, char **fp)
+panel_parse_plugin(Panel *p, char **fp)
 {
     line s;
-    plugin *plug = NULL;
+    Plugin *plug = NULL;
     gchar *type = NULL;
     int expand , padding, border;
     char* pconfig = NULL;
@@ -720,14 +724,14 @@ panel_parse_plugin(panel *p, char **fp)
 
 
 static int
-panel_start( panel *p, char **fp )
+panel_start( Panel *p, char **fp )
 {
     line s;
 
     /* parse global section */
     ENTER;
     s.len = 256;
-    memset(p, 0, sizeof(panel));
+    memset(p, 0, sizeof(Panel));
     p->allign = ALLIGN_CENTER;
     p->edge = EDGE_BOTTOM;
     p->widthtype = WIDTH_PERCENT;
@@ -743,7 +747,7 @@ panel_start( panel *p, char **fp )
     p->usefontcolor = 0;
     p->fontcolor = 0x00000000;
     p->spacing = 0;
-    fbev = fb_ev_new();
+
     if ((lxpanel_get_line(fp, &s) != LINE_BLOCK_START) || g_ascii_strcasecmp(s.t[0], "Global")) {
         ERR( "lxpanel: config file must start from Global section\n");
         RET(0);
@@ -771,12 +775,12 @@ static void
 delete_plugin(gpointer data, gpointer udata)
 {
     ENTER;
-    plugin_stop((plugin *)data);
-    plugin_put((plugin *)data);
+    plugin_stop((Plugin *)data);
+    plugin_put((Plugin *)data);
     RET();
 }
 
-void panel_stop(panel *p)
+void panel_stop(Panel *p)
 {
     ENTER;
 
@@ -794,7 +798,6 @@ void panel_stop(panel *p)
     XSelectInput (GDK_DISPLAY(), GDK_ROOT_WINDOW(), NoEventMask);
     gdk_window_remove_filter(gdk_get_default_root_window (), (GdkFilterFunc)panel_event_filter, p);
     gtk_widget_destroy(p->topgwin);
-    g_object_unref(fbev);
     g_free(p->workarea);
     g_free( p->background_file );
     g_free( p->file_manager );
@@ -998,12 +1001,14 @@ main(int argc, char *argv[], char *env[])
     gtk_icon_theme_append_search_path( gtk_icon_theme_get_default(),
                                        PACKAGE_DATA_DIR "/lxpanel/images" );
 
+       fbev = fb_ev_new();
+
 restart:
     is_restarting = FALSE;
 
     if (!(fp = pfp = load_profile(cprofile)))
         exit(1);
-    p = g_new0(panel, 1);
+    p = g_new0(Panel, 1);
     g_return_val_if_fail (p != NULL, 1);
     if (!panel_start(p, &pfp)) {
         ERR( "lxpanel: can't start panel\n");
@@ -1021,6 +1026,8 @@ restart:
     if( is_restarting )
         goto restart;
 
+    g_object_unref(fbev);
+
     return 0;
 }
 
index fe3e321..4fdeb17 100644 (file)
@@ -94,7 +94,7 @@ typedef struct {
 
     /* tooltip controller shared by many plugins */
     GtkTooltips *tooltips;
-} panel;
+} Panel;
 
 
 typedef struct {
@@ -109,7 +109,7 @@ typedef struct {
     unsigned int fullscreen : 1;
     unsigned int above : 1;
     unsigned int below : 1;
-} net_wm_state;
+} NetWMState;
 
 typedef struct {
     unsigned int desktop : 1;
@@ -120,15 +120,15 @@ typedef struct {
     unsigned int splash : 1;
     unsigned int dialog : 1;
     unsigned int normal : 1;
-} net_wm_window_type;
+} NetWMWindowType;
 
 typedef struct {
     char *name;
     char *disp_name;
     void (*cmd)(void);
-} command;
+} Command;
 
-extern command commands[];
+extern Command commands[];
 
 extern gchar *cprofile;
 
@@ -186,9 +186,9 @@ extern FbEv *fbev;
 
 #define FBPANEL_WIN(win)  gdk_window_lookup(win)
 
-void panel_set_wm_strut(panel *p);
-void panel_set_dock_type(panel *p);
-void panel_set_orientation(panel *p);
-void panel_update_background( panel* p );
+void panel_set_wm_strut(Panel *p);
+void panel_set_dock_type(Panel *p);
+void panel_set_orientation(Panel *p);
+void panel_update_background( Panel* p );
 
 #endif
index 99f1c9b..56de9ab 100644 (file)
@@ -74,13 +74,13 @@ GTypePlugin* lx_type_plugin_get(const char* plugin_name)
 
 #define REGISTER_PLUGIN_CLASS(pc, dynamic) \
 do {\
-    extern plugin_class pc;\
+    extern PluginClass pc;\
     register_plugin_class(&pc, dynamic);\
 } while (0)
 
 
 static void
-register_plugin_class(plugin_class *pc, int dynamic)
+register_plugin_class(PluginClass *pc, int dynamic)
 {
     pcl = g_list_append(pcl, pc);
     pc->dynamic = dynamic;
@@ -149,9 +149,9 @@ init_plugin_class_list()
 GList* plugin_find_class( const char* type )
 {
     GList *tmp;
-    plugin_class *pc = NULL;
+    PluginClass *pc = NULL;
     for (tmp = pcl; tmp; tmp = g_list_next(tmp)) {
-        pc = (plugin_class *) tmp->data;
+        pc = (PluginClass *) tmp->data;
         if (!g_ascii_strcasecmp(type, pc->type)) {
             LOG(LOG_INFO, "   already have it\n");
             break;
@@ -160,10 +160,10 @@ GList* plugin_find_class( const char* type )
     return tmp;
 }
 
-static plugin_class*
+static PluginClass*
 plugin_load_dynamic( const char* type, const char* path )
 {
-    plugin_class *pc = NULL;
+    PluginClass *pc = NULL;
     GModule *m;
     gpointer tmpsym;
     char class_name[ 128 ];
@@ -186,12 +186,12 @@ plugin_load_dynamic( const char* type, const char* path )
     return pc;
 }
 
-plugin *
+Plugin *
 plugin_load(char *type)
 {
     GList *tmp;
-    plugin_class *pc = NULL;
-    plugin *plug = NULL;
+    PluginClass *pc = NULL;
+    Plugin *plug = NULL;
 
     ENTER;
     if (!pcl)
@@ -200,7 +200,7 @@ plugin_load(char *type)
     tmp = plugin_find_class( type );
 
     if( tmp ) {
-        pc = (plugin_class *) tmp->data;
+        pc = (PluginClass *) tmp->data;
     }
 #ifndef DISABLE_PLUGINS_LOADING
     else if ( g_module_supported() ) {
@@ -220,7 +220,7 @@ plugin_load(char *type)
     if (!pc)
         RET(NULL);
 
-    plug = g_new0(plugin, 1);
+    plug = g_new0(Plugin, 1);
     g_return_val_if_fail (plug != NULL, NULL);
     plug->class = pc;
     pc->count++;
@@ -228,9 +228,9 @@ plugin_load(char *type)
 }
 
 
-void plugin_put(plugin *this)
+void plugin_put(Plugin *this)
 {
-    plugin_class *pc = this->class;
+    PluginClass *pc = this->class;
     ENTER;
     plugin_class_unref( pc );
     g_free(this);
@@ -238,7 +238,7 @@ void plugin_put(plugin *this)
 }
 
 int
-plugin_start(plugin *this, char** fp)
+plugin_start(Plugin *this, char** fp)
 {
     ENTER;
 
@@ -264,7 +264,7 @@ plugin_start(plugin *this, char** fp)
 }
 
 
-void plugin_stop(plugin *this)
+void plugin_stop(Plugin *this)
 {
     ENTER;
     DBG("%s\n", this->class->type);
@@ -276,7 +276,7 @@ void plugin_stop(plugin *this)
     RET();
 }
 
-void plugin_class_unref( plugin_class* pc )
+void plugin_class_unref( PluginClass* pc )
 {
     --pc->count;
     if (pc->count == 0 && pc->dynamic) {
@@ -299,10 +299,10 @@ GList* plugin_get_available_classes()
     const char* file;
     GDir* dir;
     GList* l;
-    plugin_class *pc;
+    PluginClass *pc;
 
     for( l = pcl; l; l = l->next ) {
-        pc = (plugin_class*)l->data;
+        pc = (PluginClass*)l->data;
         classes = g_list_prepend( classes, pc );
         ++pc->count;
     }
@@ -364,7 +364,7 @@ void plugin_class_list_free( GList* classes )
 }
 
 void
-plugin_widget_set_background( GtkWidget* w, panel* p )
+plugin_widget_set_background( GtkWidget* w, Panel* p )
 {
     if( ! w )
         return;
@@ -410,7 +410,7 @@ plugin_widget_set_background( GtkWidget* w, panel* p )
     }
 }
 
-void plugin_set_background( plugin* pl, panel* p )
+void plugin_set_background( Plugin* pl, Panel* p )
 {
     if( G_UNLIKELY( pl->class->invisible || ! pl->pwid ) )
         return;
index b6caa66..3ed41a3 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdio.h>
 #include "panel.h"
 
-struct _plugin *stam;
+struct _Plugin *stam;
 
 typedef struct {
     /* common */
@@ -42,30 +42,30 @@ typedef struct {
     char *version;
     char *description;
 
-    int (*constructor)(struct _plugin *this, char **fp);
-    void (*destructor)(struct _plugin *this);
-    void (*config)(struct _plugin *this, GtkWindow* parent); /* config UI */
-    void (*save)(struct _plugin *this, FILE* fp);
-    void (*orientation)(struct _plugin *this);
-} plugin_class;
+    int (*constructor)(struct _Plugin *this, char **fp);
+    void (*destructor)(struct _Plugin *this);
+    void (*config)(struct _Plugin *this, GtkWindow* parent); /* config UI */
+    void (*save)(struct _Plugin *this, FILE* fp);
+    void (*orientation)(struct _Plugin *this);
+} PluginClass;
 
-typedef struct _plugin{
-    plugin_class *class;
-    panel        *panel;
+typedef struct _Plugin{
+    PluginClass *class;
+    Panel        *panel;
     GtkWidget    *pwid;
     int           expand;
     int           padding;
     int           border;
     gpointer      priv;
-} plugin;
+} Plugin;
 
 /* if plugin is external it will load its dll */
-plugin * plugin_load(char *type);
-void plugin_put(plugin *this);
-int plugin_start(plugin *this, char **fp);
-void plugin_stop(plugin *this);
+Plugin * plugin_load(char *type);
+void plugin_put(Plugin *this);
+int plugin_start(Plugin *this, char **fp);
+void plugin_stop(Plugin *this);
 
-void plugin_class_unref( plugin_class* pc );
+void plugin_class_unref( PluginClass* pc );
 
 /*
    Get a list of all available plugin classes
@@ -75,8 +75,8 @@ void plugin_class_unref( plugin_class* pc );
 GList* plugin_get_available_classes();
 void plugin_class_list_free( GList* classes );
 
-void plugin_set_background( plugin* pl, panel* p );
-void plugin_widget_set_background( GtkWidget* w, panel* p );
+void plugin_set_background( Plugin* pl, Panel* p );
+void plugin_widget_set_background( GtkWidget* w, Panel* p );
 
 /* FIXME: optional definitions */
 #define STATIC_SEPARATOR
index 38a8c59..8581aa9 100644 (file)
@@ -110,7 +110,7 @@ typedef struct {
     sem_t *lock;
 } alarm;
 
-static void destructor(plugin *p);
+static void destructor(Plugin *p);
 static void update_display(batt *b, gboolean repaint);
 
 static void batt_info_free( batt_info* bi )
@@ -551,7 +551,7 @@ static gint exposeEvent(GtkWidget *widget, GdkEventExpose *event, batt *b) {
 
 
 static int
-constructor(plugin *p, char **fp)
+constructor(Plugin *p, char **fp)
 {
     ENTER;
 
@@ -707,7 +707,7 @@ error:
 
 
 static void
-destructor(plugin *p)
+destructor(Plugin *p)
 {
     ENTER;
 
@@ -735,7 +735,7 @@ destructor(plugin *p)
 }
 
 
-static void orientation(plugin *p) {
+static void orientation(Plugin *p) {
 
     ENTER;
 
@@ -753,7 +753,7 @@ static void orientation(plugin *p) {
 }
 
 
-static void applyConfig(plugin* p)
+static void applyConfig(Plugin* p)
 {
     ENTER;
 
@@ -796,7 +796,7 @@ static void applyConfig(plugin* p)
 }
 
 
-static void config(plugin *p, GtkWindow* parent) {
+static void config(Plugin *p, GtkWindow* parent) {
     ENTER;
 
     GtkWidget *dialog;
@@ -823,7 +823,7 @@ static void config(plugin *p, GtkWindow* parent) {
 }
 
 
-static void save(plugin* p, FILE* fp) {
+static void save(Plugin* p, FILE* fp) {
 
     ENTER;
 
@@ -844,7 +844,7 @@ static void save(plugin* p, FILE* fp) {
 }
 
 
-plugin_class batt_plugin_class = {
+PluginClass batt_plugin_class = {
     fname       : NULL,
     count       : 0,
 
index 6b8a347..5357bc6 100644 (file)
@@ -149,7 +149,7 @@ expose_event(GtkWidget *widget, GdkEventExpose *event, cpu_t *c)
 }
 
 static int
-cpu_constructor(plugin *p, char **fp)
+cpu_constructor(Plugin *p, char **fp)
 {
     cpu_t *c;
 
@@ -166,7 +166,7 @@ cpu_constructor(plugin *p, char **fp)
     gtk_widget_show(c->da);
 
     c->gc_cpu = gdk_gc_new(p->panel->topgwin->window);
-    DBG("here1\n");
+
     c->ccpu = (GdkColor *)malloc(sizeof(GdkColor));
     gdk_color_parse("green",  c->ccpu);
     gdk_colormap_alloc_color(gdk_drawable_get_colormap(p->panel->topgwin->window),  c->ccpu, FALSE, TRUE);
@@ -185,7 +185,7 @@ cpu_constructor(plugin *p, char **fp)
 }
 
 static void
-cpu_destructor(plugin *p)
+cpu_destructor(Plugin *p)
 {
     cpu_t *c = (cpu_t *) p->priv;
 
@@ -201,7 +201,7 @@ cpu_destructor(plugin *p)
 }
 
 
-plugin_class cpu_plugin_class = {
+PluginClass cpu_plugin_class = {
     fname: NULL,
     count: 0,
 
index 0136444..4d54b52 100644 (file)
@@ -53,7 +53,7 @@ typedef struct {
 } dclock;
 
 static void
-update_label_orient( plugin* p );
+update_label_orient( Plugin* p );
 
 static GtkWidget *create_calendar()
 {
@@ -62,13 +62,17 @@ static GtkWidget *create_calendar()
 
     /* create a new window */
     win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       gtk_window_set_default_size(GTK_WINDOW(win), 180, 180);
     gtk_window_set_decorated(GTK_WINDOW(win), FALSE);
-    gtk_container_set_border_width(GTK_CONTAINER(win), 5);
-    gtk_widget_set_size_request(GTK_WIDGET(win), 180, 180);
+    gtk_window_set_resizable (GTK_WINDOW(win), FALSE);
+    gtk_container_set_border_width(GTK_CONTAINER(win), 0);
     gtk_window_set_skip_taskbar_hint(GTK_WINDOW(win), TRUE);
     gtk_window_set_skip_pager_hint(GTK_WINDOW(win), TRUE);
-    gtk_window_set_type_hint(GTK_WINDOW(win), GDK_WINDOW_TYPE_HINT_DIALOG);
+    gtk_window_set_type_hint(GTK_WINDOW(win), GDK_WINDOW_TYPE_HINT_DOCK);
     gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_MOUSE);
+    gtk_window_stick (GTK_WINDOW(win));
+
+       GtkVBox* box = gtk_vbox_new(FALSE, 0);
 
     /* calendar */
     calendar = gtk_calendar_new();
@@ -76,7 +80,9 @@ static GtkWidget *create_calendar()
                                  GTK_CALENDAR_SHOW_WEEK_NUMBERS |
                                  GTK_CALENDAR_SHOW_DAY_NAMES |
                                  GTK_CALENDAR_SHOW_HEADING);
-    gtk_container_add(GTK_CONTAINER(win), calendar);
+//    gtk_container_add(GTK_CONTAINER(win), calendar);
+       gtk_box_pack_start_defaults( box, calendar );
+    gtk_container_add(GTK_CONTAINER(win), box);
 
     gtk_widget_show_all(win);
 
@@ -154,7 +160,7 @@ clock_update(gpointer data )
 
 
 static int
-dclock_constructor(plugin *p, char** fp)
+dclock_constructor(Plugin *p, char** fp)
 {
     line s;
     dclock *dc;
@@ -225,7 +231,7 @@ dclock_constructor(plugin *p, char** fp)
 
     clock_update( dc );
 
-    /* store the created plugin widget in plugin->pwid */
+    /* store the created Plugin widget in Plugin->pwid */
     p->pwid = dc->main;
 
     RET(1);
@@ -240,7 +246,7 @@ dclock_constructor(plugin *p, char** fp)
 
 
 static void
-dclock_destructor(plugin *p)
+dclock_destructor(Plugin *p)
 {
     dclock *dc = (dclock *)p->priv;
 
@@ -258,7 +264,7 @@ dclock_destructor(plugin *p)
     RET();
 }
 
-static void apply_config( plugin* p )
+static void apply_config( Plugin* p )
 {
     /* NOTE: This dirty hack is used to force the update of tooltip
        because tooltip will be updated when dc->lastDay != today.
@@ -268,7 +274,7 @@ static void apply_config( plugin* p )
     clock_update( dc );
 }
 
-static void dclock_config( plugin *p, GtkWindow* parent )
+static void dclock_config( Plugin *p, GtkWindow* parent )
 {
     GtkWidget* dlg;
     dclock *dc = (dclock *)p->priv;
@@ -283,7 +289,7 @@ static void dclock_config( plugin *p, GtkWindow* parent )
     gtk_window_present( GTK_WINDOW(dlg) );
 }
 
-static void save_config( plugin* p, FILE* fp )
+static void save_config( Plugin* p, FILE* fp )
 {
     dclock *dc = (dclock *)p->priv;
     lxpanel_put_str( fp, "ClockFmt", dc->cfmt );
@@ -293,7 +299,7 @@ static void save_config( plugin* p, FILE* fp )
 }
 
 static void
-update_label_orient( plugin* p )
+update_label_orient( Plugin* p )
 {
     dclock *dc = (dclock *)p->priv;
     GtkLabel* label = GTK_LABEL(dc->clockw);
@@ -308,7 +314,7 @@ update_label_orient( plugin* p )
     gtk_label_set_angle( GTK_LABEL(label), angle );
 }
 
-plugin_class dclock_plugin_class = {
+PluginClass dclock_plugin_class = {
     fname: NULL,
     count: 0,
 
index 03d7acd..1397720 100644 (file)
@@ -53,7 +53,7 @@ name_update(GtkWidget *widget, deskno *dc)
 
 
 static int
-deskno_constructor(plugin *p, char** fp)
+deskno_constructor(Plugin *p, char** fp)
 {
     deskno *dc;
     GtkWidget *button;
@@ -81,7 +81,7 @@ deskno_constructor(plugin *p, char** fp)
 
 
 static void
-deskno_destructor(plugin *p)
+deskno_destructor(Plugin *p)
 {
   deskno *dc = (deskno *)p->priv;
 
@@ -92,7 +92,7 @@ deskno_destructor(plugin *p)
   RET();
 }
 
-plugin_class deskno_plugin_class = {
+PluginClass deskno_plugin_class = {
     fname: NULL,
     count: 0,
 
index 5baa716..6814bf8 100644 (file)
@@ -81,7 +81,7 @@ scroll (GtkWidget *widget, GdkEventScroll *event, deskno *dc)
 }
 
 static int
-deskno_constructor(plugin *p, char** fp)
+deskno_constructor(Plugin *p, char** fp)
 {
     deskno *dc;
     ENTER;
@@ -110,7 +110,7 @@ deskno_constructor(plugin *p, char** fp)
 
 
 static void
-deskno_destructor(plugin *p)
+deskno_destructor(Plugin *p)
 {
   deskno *dc = (deskno *)p->priv;
 
@@ -121,7 +121,7 @@ deskno_destructor(plugin *p)
   RET();
 }
 
-plugin_class deskno2_plugin_class = {
+PluginClass deskno2_plugin_class = {
     fname: NULL,
     count: 0,
 
index 7b57a4b..96510cc 100644 (file)
@@ -33,7 +33,7 @@
 #define PATH_ID GPOINTER_TO_UINT("path")
 
 typedef struct {
-    panel* panel;
+    Panel* panel;
     char* image;
     char* path;
     GtkWidget *button;
@@ -41,11 +41,11 @@ typedef struct {
 
 static GdkPixbuf* folder_icon = NULL;
 
-static GtkWidget* create_menu( plugin* p,
+static GtkWidget* create_menu( Plugin* p,
                                const char* path,
                                gboolean open_at_top );
 
-static void open_dir( plugin* p, const char* path )
+static void open_dir( Plugin* p, const char* path )
 {
     char* cmd;
     char* quote = g_shell_quote( path );
@@ -59,21 +59,21 @@ static void open_dir( plugin* p, const char* path )
     g_free( cmd );
 }
 
-static void on_open_dir( GtkWidget* item, plugin* p )
+static void on_open_dir( GtkWidget* item, Plugin* p )
 {
     GtkWidget* menu = gtk_widget_get_parent(item);
     const char* path = g_object_get_qdata( menu, PATH_ID );
     open_dir( p, path );
 }
 
-static void open_in_term( plugin* p, const char* path )
+static void open_in_term( Plugin* p, const char* path )
 {
     const char* term = lxpanel_get_terminal( p->panel );
     chdir( path );
     g_spawn_command_line_async( term, NULL );
 }
 
-static void on_open_in_term( GtkWidget* item, plugin* p )
+static void on_open_in_term( GtkWidget* item, Plugin* p )
 {
     GtkWidget* menu = gtk_widget_get_parent(item);
     const char* path = g_object_get_qdata( menu, PATH_ID );
@@ -81,7 +81,7 @@ static void on_open_in_term( GtkWidget* item, plugin* p )
 }
 
 static void
-menu_pos( GtkMenu *menu, gint *x, gint *y, gboolean *push_in, plugin* p )
+menu_pos( GtkMenu *menu, gint *x, gint *y, gboolean *push_in, Plugin* p )
 {
     int ox, oy, w, h;
     dirmenu *dm = (dirmenu *)p->priv;
@@ -109,7 +109,7 @@ menu_pos( GtkMenu *menu, gint *x, gint *y, gboolean *push_in, plugin* p )
     RET();
 }
 
-static void on_select( GtkMenuItem* item, plugin* p )
+static void on_select( GtkMenuItem* item, Plugin* p )
 {
     GtkMenu* parent;
     GtkWidget* sub = gtk_menu_item_get_submenu( item );
@@ -129,14 +129,14 @@ static void on_select( GtkMenuItem* item, plugin* p )
 
 #if GTK_CHECK_VERSION(2, 10, 0)
 /* NOTE: It seems that this doesn't work in older versions of gtk+?? */
-static void on_deselect( GtkMenuItem* item, plugin* p )
+static void on_deselect( GtkMenuItem* item, Plugin* p )
 {
     /* delete old menu on deselect to save resource */
     gtk_menu_item_set_submenu( item, gtk_menu_new() );
 }
 #endif
 
-void on_sel_done( GtkWidget *menu, plugin* p )
+void on_sel_done( GtkWidget *menu, Plugin* p )
 {
     gtk_widget_destroy( menu );
     if( folder_icon )
@@ -146,7 +146,7 @@ void on_sel_done( GtkWidget *menu, plugin* p )
     }
 }
 
-static GtkWidget* create_menu( plugin* p,
+static GtkWidget* create_menu( Plugin* p,
                                const char* path,
                                gboolean open_at_top )
 {
@@ -222,7 +222,7 @@ static GtkWidget* create_menu( plugin* p,
     return menu;
 }
 
-static void show_menu( GtkWidget* widget, plugin *p, int btn, guint32 time )
+static void show_menu( GtkWidget* widget, Plugin *p, int btn, guint32 time )
 {
     dirmenu *dm = (dirmenu *)p->priv;
     char* path = dm->path ? expand_tilda(dm->path) : NULL;
@@ -241,7 +241,7 @@ static void show_menu( GtkWidget* widget, plugin *p, int btn, guint32 time )
 static gint
 clicked (GtkWidget *widget, GdkEventButton *event, gpointer data)
 {
-    plugin *p = (plugin*)data;
+    Plugin *p = (Plugin*)data;
     dirmenu *dm = (dirmenu *)p->priv;
 
     ENTER;
@@ -264,7 +264,7 @@ clicked (GtkWidget *widget, GdkEventButton *event, gpointer data)
 }
 
 static void
-dirmenu_destructor(plugin *p)
+dirmenu_destructor(Plugin *p)
 {
     dirmenu *dm = (dirmenu *)p->priv;
     ENTER;
@@ -275,7 +275,7 @@ dirmenu_destructor(plugin *p)
 }
 
 static int
-dirmenu_constructor(plugin *p, char **fp)
+dirmenu_constructor(Plugin *p, char **fp)
 {
     line s;
     gchar *fname;
@@ -353,14 +353,14 @@ dirmenu_constructor(plugin *p, char **fp)
     RET(0);
 }
 
-static void save_config( plugin* p, FILE* fp )
+static void save_config( Plugin* p, FILE* fp )
 {
     dirmenu* dm = (dirmenu*)p->priv;
     lxpanel_put_str( fp, "path", dm->path );
     lxpanel_put_str( fp, "image", dm->image );
 }
 
-plugin_class dirmenu_plugin_class = {
+PluginClass dirmenu_plugin_class = {
     fname: NULL,
     count: 0,
 
index 2166d5a..9936fdf 100644 (file)
@@ -38,7 +38,7 @@ typedef struct {
 } image;
 
 static void
-image_destructor(plugin *p)
+image_destructor(Plugin *p)
 {
     image *img = (image *)p->priv;
 
@@ -55,7 +55,7 @@ image_destructor(plugin *p)
 }
 
 static int
-image_constructor(plugin *p, char **fp)
+image_constructor(Plugin *p, char **fp)
 {
     gchar *tooltip, *fname;
     image *img;
@@ -153,7 +153,7 @@ image_constructor(plugin *p, char **fp)
     RET(0);
 }
 
-static void save_config( plugin* p, FILE* fp )
+static void save_config( Plugin* p, FILE* fp )
 {
     image *img = (image *)p->priv;
     if( img->config_data ) {
@@ -168,7 +168,7 @@ static void save_config( plugin* p, FILE* fp )
     }
 }
 
-plugin_class image_plugin_class = {
+PluginClass image_plugin_class = {
     fname: NULL,
     count: 0,
 
index 9f7d365..7f34dc5 100644 (file)
@@ -123,7 +123,7 @@ on_button_pressed(GtkWidget *widget, GdkEventButton *event, btn_t *b )
 }
 
 static void
-launchbar_destructor(plugin *p)
+launchbar_destructor(Plugin *p)
 {
     launchbar *lb = (launchbar *)p->priv;
 
@@ -187,7 +187,7 @@ drag_data_received_cb (GtkWidget        *widget,
 }
 
 static int
-read_button(plugin *p, char** fp)
+read_button(Plugin *p, char** fp)
 {
     launchbar *lb = (launchbar *)p->priv;
     gchar *fname;
@@ -328,7 +328,7 @@ read_button(plugin *p, char** fp)
 }
 
 static int
-launchbar_constructor(plugin *p, char **fp)
+launchbar_constructor(Plugin *p, char **fp)
 {
     launchbar *lb;
     line s;
@@ -415,7 +415,7 @@ launchbar_constructor(plugin *p, char **fp)
 
 }
 
-static void save_config( plugin* p, FILE* fp )
+static void save_config( Plugin* p, FILE* fp )
 {
     launchbar *lb = (launchbar *)p->priv;
     GSList* l;
@@ -434,7 +434,7 @@ static void save_config( plugin* p, FILE* fp )
     }
 }
 
-static void orientation_changed( plugin* p )
+static void orientation_changed( Plugin* p )
 {
     launchbar *lb = (launchbar *)p->priv;
     GtkBox* newbox;
@@ -448,7 +448,7 @@ static void orientation_changed( plugin* p )
 }
 
 static void
-on_response( GtkDialog* dlg, int response, plugin* p )
+on_response( GtkDialog* dlg, int response, Plugin* p )
 {
     launchbar *lb = (launchbar *)p->priv;
     gtk_widget_destroy( GTK_WIDGET(dlg) );
@@ -461,7 +461,7 @@ static void on_add_btn_response( GtkDialog* dlg, int response, int* ret )
     gtk_main_quit();
 }
 
-static void on_add_btn( GtkButton* widget, plugin* p )
+static void on_add_btn( GtkButton* widget, Plugin* p )
 {
     launchbar *lb = (launchbar *)p->priv;
     GtkTreeView* view = (GtkTreeView*)g_object_get_data( (GObject *) lb->config_dlg, "view" );
@@ -534,7 +534,7 @@ static void on_add_btn( GtkButton* widget, plugin* p )
     gtk_widget_destroy( dlg );
 }
 
-static void on_remove_btn( GtkButton* widget, plugin* p )
+static void on_remove_btn( GtkButton* widget, Plugin* p )
 {
     launchbar *lb = (launchbar *)p->priv;
     GtkTreeView* view = (GtkTreeView*)g_object_get_data( lb->config_dlg, "view" );
@@ -555,7 +555,7 @@ static void on_remove_btn( GtkButton* widget, plugin* p )
     }
 }
 
-static void on_up_btn( GtkButton* widget, plugin* p )
+static void on_up_btn( GtkButton* widget, Plugin* p )
 {
     launchbar *lb = (launchbar *)p->priv;
     btn_t *btn;
@@ -584,7 +584,7 @@ static void on_up_btn( GtkButton* widget, plugin* p )
     gtk_tree_path_free( path );
 }
 
-static void on_down_btn( GtkButton* widget, plugin* p )
+static void on_down_btn( GtkButton* widget, Plugin* p )
 {
     launchbar *lb = (launchbar *)p->priv;
     btn_t *btn;
@@ -614,7 +614,7 @@ static void on_down_btn( GtkButton* widget, plugin* p )
     gtk_tree_path_free( path );
 }
 
-static void init_btn_list( plugin* p, GtkTreeView* view )
+static void init_btn_list( Plugin* p, GtkTreeView* view )
 {
     launchbar *lb = (launchbar *)p->priv;
     GtkListStore *list;
@@ -675,7 +675,7 @@ static void init_btn_list( plugin* p, GtkTreeView* view )
     g_object_set_data( lb->config_dlg, "view", view );
 }
 
-static void launchbar_config( plugin *p, GtkWindow* parent )
+static void launchbar_config( Plugin *p, GtkWindow* parent )
 {
     GtkWidget *dlg, *hbox, *vbox, *scroll, *view, *btn, *img;
     launchbar *lb = (launchbar *)p->priv;
@@ -739,7 +739,7 @@ static void launchbar_config( plugin *p, GtkWindow* parent )
     gtk_window_present( GTK_WINDOW(lb->config_dlg) );
 }
 
-plugin_class launchbar_plugin_class = {
+PluginClass launchbar_plugin_class = {
     fname: NULL,
     count: 0,
 
index 26c5ea8..391abe1 100644 (file)
@@ -56,7 +56,7 @@ typedef struct {
 static guint idle_loader = 0;
 
 static void
-menu_destructor(plugin *p)
+menu_destructor(Plugin *p)
 {
     menup *m = (menup *)p->priv;
 
@@ -107,7 +107,7 @@ static void
 menu_pos(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, GtkWidget *widget)
 {
     int ox, oy, w, h;
-    plugin *p;
+    Plugin *p;
 
     ENTER;
     p = g_object_get_data(G_OBJECT(widget), "plugin");
@@ -163,7 +163,7 @@ reload_system_menu( GtkMenu* menu )
     g_list_free( children );
 }
 
-static void show_menu( GtkWidget* widget, plugin* p, int btn, guint32 time )
+static void show_menu( GtkWidget* widget, Plugin* p, int btn, guint32 time )
 {
     menup* m = (menup*)p->priv;
     /* reload system menu items if needed */
@@ -172,7 +172,7 @@ static void show_menu( GtkWidget* widget, plugin* p, int btn, guint32 time )
         /* FIXME: Reload all system menus here.
                   This is dirty, but I don't know any better way. */
         for( l = p->panel->system_menus; l; l = l->next ) {
-            plugin* _p = (plugin*)l->data;
+            Plugin* _p = (Plugin*)l->data;
             menup* _m = (menup*)_p->priv;
             reload_system_menu( GTK_MENU(_m->menu) );
         }
@@ -184,7 +184,7 @@ static void show_menu( GtkWidget* widget, plugin* p, int btn, guint32 time )
 }
 
 static gboolean
-my_button_pressed(GtkWidget *widget, GdkEventButton *event, plugin* p)
+my_button_pressed(GtkWidget *widget, GdkEventButton *event, Plugin* p)
 {
     ENTER;
     if ((event->type == GDK_BUTTON_PRESS)
@@ -197,14 +197,14 @@ my_button_pressed(GtkWidget *widget, GdkEventButton *event, plugin* p)
 
 gboolean show_system_menu( gpointer system_menu )
 {
-    plugin* p = (plugin*)system_menu;
+    Plugin* p = (Plugin*)system_menu;
     menup* m = (menup*)p->priv;
     show_menu( m->bg, p, 0, GDK_CURRENT_TIME );
     return FALSE;
 }
 
 static GtkWidget *
-make_button(plugin *p, gchar *fname, gchar *name, GtkWidget *menu)
+make_button(Plugin *p, gchar *fname, gchar *name, GtkWidget *menu)
 {
     int w, h;
     menup *m;
@@ -233,13 +233,13 @@ make_button(plugin *p, gchar *fname, gchar *name, GtkWidget *menu)
 
 
 static GtkWidget *
-read_item(plugin *p, char** fp)
+read_item(Plugin *p, char** fp)
 {
     line s;
     gchar *name, *fname, *action;
     GtkWidget *item;
     menup *m = (menup *)p->priv;
-    command *cmd_entry = NULL;
+    Command *cmd_entry = NULL;
 
     ENTER;
     s.len = 256;
@@ -256,7 +256,7 @@ read_item(plugin *p, char** fp)
                 else if (!g_ascii_strcasecmp(s.t[0], "action"))
                     action = g_strdup(s.t[1]);
                 else if (!g_ascii_strcasecmp(s.t[0], "command")) {
-                    command *tmp;
+                    Command *tmp;
 
                     for (tmp = commands; tmp->name; tmp++) {
                         if (!g_ascii_strcasecmp(s.t[1], tmp->name)) {
@@ -304,7 +304,7 @@ read_item(plugin *p, char** fp)
 }
 
 static GtkWidget *
-read_separator(plugin *p, char **fp)
+read_separator(Plugin *p, char **fp)
 {
     line s;
 
@@ -320,13 +320,13 @@ read_separator(plugin *p, char **fp)
     RET(gtk_separator_menu_item_new());
 }
 
-static gboolean on_idle( panel* p )
+static gboolean on_idle( Panel* p )
 {
     GSList* l;
     /* Reload all system menus here.
         This is dirty, but I don't know any better way. */
     for( l = p->system_menus; l; l = l->next ) {
-        plugin* _p = (plugin*)l->data;
+        Plugin* _p = (Plugin*)l->data;
         menup* _m = (menup*)_p->priv;
         reload_system_menu( GTK_MENU(_m->menu) );
     }
@@ -335,7 +335,7 @@ static gboolean on_idle( panel* p )
 }
 
 static void
-read_system_menu(GtkMenu* menu, plugin *p, char** fp)
+read_system_menu(GtkMenu* menu, Plugin *p, char** fp)
 {
    line s;
    menup *m = (menup *)p->priv;
@@ -371,7 +371,7 @@ read_system_menu(GtkMenu* menu, plugin *p, char** fp)
 }
 
 static void
-read_include(plugin *p, char **fp)
+read_include(Plugin *p, char **fp)
 {
     ENTER;
 #if 0
@@ -408,7 +408,7 @@ read_include(plugin *p, char **fp)
 }
 
 static GtkWidget *
-read_submenu(plugin *p, char** fp, gboolean as_item)
+read_submenu(Plugin *p, char** fp, gboolean as_item)
 {
     line s;
     GtkWidget *mi, *menu;
@@ -496,7 +496,7 @@ read_submenu(plugin *p, char** fp, gboolean as_item)
 }
 
 static int
-menu_constructor(plugin *p, char **fp)
+menu_constructor(Plugin *p, char **fp)
 {
     menup *m;
     static char default_config[] =
@@ -565,7 +565,7 @@ menu_constructor(plugin *p, char **fp)
     RET(0);
 }
 
-static void save_config( plugin* p, FILE* fp )
+static void save_config( Plugin* p, FILE* fp )
 {
     menup* menu = (menup*)p->priv;
     if( menu->config_data ) {
@@ -580,7 +580,7 @@ static void save_config( plugin* p, FILE* fp )
     }
 }
 
-plugin_class menu_plugin_class = {
+PluginClass menu_plugin_class = {
     fname: NULL,
     count: 0,
 
index cd093b5..98e6a42 100644 (file)
@@ -301,7 +301,7 @@ static gboolean refresh_devstat(netstat *ns)
 }
 
 /* Plugin constructor */
-static void netstat_destructor(plugin *p)
+static void netstat_destructor(Plugin *p)
 {
     netstat *ns = (netstat *) p->priv;
 
@@ -320,7 +320,7 @@ static void netstat_destructor(plugin *p)
     RET();
 }
 
-static int netstat_constructor(plugin *p, char **fp)
+static int netstat_constructor(Plugin *p, char **fp)
 {
     netstat *ns;
     line s;
@@ -383,7 +383,7 @@ error:
     RET(0);
 }
 
-static void orientation_changed(plugin* p)
+static void orientation_changed(Plugin* p)
 {
     netstat *ns = (netstat *)p->priv;
     GtkBox* newbox;
@@ -396,7 +396,7 @@ static void orientation_changed(plugin* p)
     }
 }
 
-plugin_class netstat_plugin_class = {
+PluginClass netstat_plugin_class = {
     fname: NULL,
     count: 0,
 
index 1a6cce4..7a8674f 100644 (file)
@@ -40,7 +40,7 @@ typedef struct {
 
 
 static void
-netstatus_destructor(plugin *p)
+netstatus_destructor(Plugin *p)
 {
     netstatus *ns = (netstatus *)p->priv;
 
@@ -66,7 +66,7 @@ static void on_response( GtkDialog* dlg, gint response, netstatus *ns )
     }
 }
 
-static void on_button_press( GtkWidget* widget, GdkEventButton* evt, plugin* p )
+static void on_button_press( GtkWidget* widget, GdkEventButton* evt, Plugin* p )
 {
     NetstatusIface* iface;
     netstatus *ns = (netstatus*)p->priv;
@@ -89,7 +89,7 @@ static void on_button_press( GtkWidget* widget, GdkEventButton* evt, plugin* p )
 }
 
 static int
-netstatus_constructor(plugin *p, char** fp)
+netstatus_constructor(Plugin *p, char** fp)
 {
     netstatus *ns;
     line s;
@@ -147,12 +147,12 @@ netstatus_constructor(plugin *p, char** fp)
     RET(0);
 }
 
-static void apply_config( plugin* p )
+static void apply_config( Plugin* p )
 {
 
 }
 
-static void netstatus_config( plugin* p, GtkWindow* parent  )
+static void netstatus_config( Plugin* p, GtkWindow* parent  )
 {
     GtkWidget* dlg;
     netstatus *ns = (netstatus*)p->priv;
@@ -166,14 +166,14 @@ static void netstatus_config( plugin* p, GtkWindow* parent  )
     gtk_window_present( GTK_WINDOW(dlg) );
 }
 
-static void save_config( plugin* p, FILE* fp )
+static void save_config( Plugin* p, FILE* fp )
 {
     netstatus *ns = (netstatus*)p->priv;
     lxpanel_put_str( fp, "iface", ns->iface );
     lxpanel_put_str( fp, "configtool", ns->config_tool );
 }
 
-plugin_class netstatus_plugin_class = {
+PluginClass netstatus_plugin_class = {
     fname: NULL,
     count: 0,
 
index 707ba74..4d7d103 100644 (file)
@@ -39,9 +39,6 @@
 //#define DEBUG
 #include "dbg.h"
 
-
-extern panel *p;
-
 /* managed window: all related info that wm holds about its managed windows */
 typedef struct task {
     Window win;
@@ -52,8 +49,8 @@ typedef struct task {
     guint desktop;
     char *name, *iname;
     int ws;
-    net_wm_state nws;
-    net_wm_window_type nwwt;
+    NetWMState nws;
+    NetWMWindowType nwwt;
     guint focused:1;
 } task;
 
@@ -71,6 +68,7 @@ struct _desk {
 };
 
 struct _pager {
+       Plugin* plugin;
     GtkWidget *box, *eb;
     desk *desks[MAX_DESK_NUM];
     guint desknum;
@@ -168,12 +166,14 @@ task_update_pix(task *t, desk *d)
 {
     int x, y, w, h;
     GtkWidget *widget;
+    Panel* p;
 
     ENTER;
     g_return_if_fail(d->pix != NULL);
     if (!TASK_VISIBLE(t))
         RET();;
 
+       p = d->pg->plugin->panel;
     if (t->desktop < p->desknum &&
           t->desktop != d->no)
         RET();
@@ -294,6 +294,7 @@ desk_expose_event (GtkWidget *widget, GdkEventExpose *event, desk *d)
 static gint
 desk_configure_event (GtkWidget *widget, GdkEventConfigure *event, desk *d)
 {
+       Panel* p;
     int w, h;
     ENTER;
     DBG("d->no=%d %dx%d\n", d->no, widget->allocation.width, widget->allocation.height);
@@ -309,6 +310,7 @@ desk_configure_event (GtkWidget *widget, GdkEventConfigure *event, desk *d)
     d->scaleh = (gfloat)widget->allocation.width  / (gfloat)gdk_screen_width();
     desk_set_dirty(d);
 
+       p = d->pg->plugin->panel;
     //request best size
     if (p->orientation != ORIENT_HORIZ) {
         w = widget->allocation.width;
@@ -629,7 +631,7 @@ pager_rebuild_all(FbEv *ev, pager *pg)
 
 
 static int
-pager_constructor(plugin *plug, char **fp)
+pager_constructor(Plugin *plug, char **fp)
 {
     pager *pg;
 
@@ -637,6 +639,7 @@ pager_constructor(plugin *plug, char **fp)
     pg = g_new0(pager, 1);
     g_return_val_if_fail(pg != NULL, 0);
     plug->priv = pg;
+    pg->plugin = plug;
 
     plug->pwid = gtk_event_box_new();
     GTK_WIDGET_SET_FLAGS( plug->pwid, GTK_NO_WINDOW );
@@ -673,7 +676,7 @@ pager_constructor(plugin *plug, char **fp)
 }
 
 static void
-pager_destructor(plugin *p)
+pager_destructor(Plugin *p)
 {
     pager *pg = (pager *)p->priv;
 
@@ -694,7 +697,7 @@ pager_destructor(plugin *p)
 }
 
 
-plugin_class pager_plugin_class = {
+PluginClass pager_plugin_class = {
     fname: NULL,
     count: 0,
 
index 5f93508..cc89994 100644 (file)
@@ -27,7 +27,7 @@
 
 
 static int
-separator_constructor(plugin *p, char **fp)
+separator_constructor(Plugin *p, char **fp)
 {
     GtkWidget *sep, *eb;
     line s;
@@ -57,7 +57,7 @@ separator_constructor(plugin *p, char **fp)
 }
 
 static void
-separator_destructor(plugin *p)
+separator_destructor(Plugin *p)
 {
     ENTER;
 /* The widget is destroyed in plugin_stop().
@@ -67,7 +67,7 @@ separator_destructor(plugin *p)
     RET();
 }
 
-static void orientation_changed( plugin* p )
+static void orientation_changed( Plugin* p )
 {
     GtkWidget* eb = GTK_WIDGET((GtkEventBox*)p->priv);
     GtkWidget* sep = gtk_bin_get_child( GTK_BIN(eb) );
@@ -85,7 +85,7 @@ static void orientation_changed( plugin* p )
     gtk_container_add (GTK_CONTAINER (eb), sep);
 }
 
-plugin_class separator_plugin_class = {
+PluginClass separator_plugin_class = {
     fname: NULL,
     count: 0,
 
index 5796f70..aaec1cd 100644 (file)
@@ -38,7 +38,7 @@ typedef struct {
 
 
 static void
-space_destructor(plugin *p)
+space_destructor(Plugin *p)
 {
     space *sp = (space *)p->priv;
 
@@ -54,7 +54,7 @@ space_destructor(plugin *p)
 
 
 static int
-space_constructor(plugin *p, char** fp)
+space_constructor(Plugin *p, char** fp)
 {
     space *sp;
     line s;
@@ -108,7 +108,7 @@ space_constructor(plugin *p, char** fp)
     RET(0);
 }
 
-static void apply_config( plugin* p )
+static void apply_config( Plugin* p )
 {
     int w, h;
     space *sp = (space *)p->priv;
@@ -123,7 +123,7 @@ static void apply_config( plugin* p )
     gtk_widget_set_size_request(p->pwid, w, h);
 }
 
-static void space_config(plugin* p, GtkWindow* parent )
+static void space_config(Plugin* p, GtkWindow* parent )
 {
     GtkWidget* dlg;
     space *sp = (space *)p->priv;
@@ -134,13 +134,13 @@ static void space_config(plugin* p, GtkWindow* parent )
     gtk_window_present( GTK_WINDOW(dlg) );
 }
 
-static void save_config( plugin* p, FILE* fp )
+static void save_config( Plugin* p, FILE* fp )
 {
     space *sp = (space *)p->priv;
     lxpanel_put_int( fp, "Size", sp->size );
 }
 
-plugin_class space_plugin_class = {
+PluginClass space_plugin_class = {
     fname: NULL,
     count: 0,
 
index 0cbd41a..5de9e1d 100644 (file)
@@ -62,8 +62,8 @@ typedef struct _task{
     int pos_x;
     int width;
     int desktop;
-    net_wm_state nws;
-    net_wm_window_type nwwt;
+    NetWMState nws;
+    NetWMWindowType nwwt;
     guint flash_timeout;
     unsigned int focused:1;
     unsigned int iconified:1;
@@ -74,7 +74,7 @@ typedef struct _task{
 } task;
 
 typedef struct _taskbar{
-    plugin *plug;
+    Plugin *plug;
     Window *wins;
     Window topxwin;
     int win_num;
@@ -130,7 +130,7 @@ static gboolean use_net_active=FALSE;
 static void tk_display(taskbar *tb, task *tk);
 static void tb_propertynotify(taskbar *tb, XEvent *ev);
 static GdkFilterReturn tb_event_filter( XEvent *, GdkEvent *, taskbar *);
-static void taskbar_destructor(plugin *p);
+static void taskbar_destructor(Plugin *p);
 
 static gboolean tk_has_urgency( task* tk );
 
@@ -162,14 +162,14 @@ task_visible(taskbar *tb, task *tk)
 }
 
 static int
-accept_net_wm_state(net_wm_state *nws, int accept_skip_pager)
+accept_net_wm_state(NetWMState *nws, int accept_skip_pager)
 {
     ENTER;
     RET(!(nws->skip_taskbar || (accept_skip_pager && nws->skip_pager)));
 }
 
 static int
-accept_net_wm_window_type(net_wm_window_type *nwwt)
+accept_net_wm_window_type(NetWMWindowType *nwwt)
 {
     ENTER;
     RET(!(nwwt->desktop || nwwt->dock || nwwt->splash));
@@ -917,8 +917,8 @@ tb_net_client_list(GtkWidget *widget, taskbar *tb)
         if ((tk = g_hash_table_lookup(tb->task_list, &tb->wins[i]))) {
             ++tk->refcount;
         } else {
-            net_wm_window_type nwwt;
-            net_wm_state nws;
+            NetWMWindowType nwwt;
+            NetWMState nws;
 
             get_net_wm_state(tb->wins[i], &nws);
             if (!accept_net_wm_state(&nws, tb->accept_skip_pager))
@@ -1072,7 +1072,6 @@ tb_propertynotify(taskbar *tb, XEvent *ev)
             //tk_display(tb, tk);
         }  else if (at == XA_WM_CLASS) {
                 DBG("WM_CLASS\n");
-
                 //get_wmclass(tk);
         } else if (at == a_WM_STATE)    {
                 DBG("WM_STATE\n");
@@ -1096,7 +1095,7 @@ tb_propertynotify(taskbar *tb, XEvent *ev)
                     }
                 }
             } else if (at == a_NET_WM_STATE) {
-                net_wm_state nws;
+                NetWMState nws;
 
             DBG("_NET_WM_STATE\n");
             get_net_wm_state(tk->win, &nws);
@@ -1112,7 +1111,7 @@ tb_propertynotify(taskbar *tb, XEvent *ev)
             gtk_image_set_from_pixbuf (GTK_IMAGE(tk->image), tk->pixbuf);
                 DBG("#2 %d\n", GDK_IS_PIXBUF (tk->pixbuf));
         } else if (at == a_NET_WM_WINDOW_TYPE) {
-                net_wm_window_type nwwt;
+                NetWMWindowType nwwt;
 
             DBG("_NET_WM_WINDOW_TYPE\n");
             get_net_wm_window_type(tk->win, &nwwt);
@@ -1278,7 +1277,7 @@ taskbar_make_menu(taskbar *tb)
 
 
 static void
-taskbar_build_gui(plugin *p)
+taskbar_build_gui(Plugin *p)
 {
     taskbar *tb = (taskbar *)p->priv;
     GtkOrientation  bo;
@@ -1347,7 +1346,7 @@ void net_active_detect()
 }
 
 static int
-taskbar_constructor(plugin *p, char** fp)
+taskbar_constructor(Plugin *p, char** fp)
 {
     taskbar *tb;
     line s;
@@ -1442,7 +1441,7 @@ taskbar_constructor(plugin *p, char** fp)
 
 
 static void
-taskbar_destructor(plugin *p)
+taskbar_destructor(Plugin *p)
 {
     taskbar *tb = (taskbar *)p->priv;
 
@@ -1470,7 +1469,7 @@ update_icons_only( gpointer key, task* tk, gpointer icons_only )
         gtk_widget_show( tk->label );
 }
 
-static void apply_config( plugin* p )
+static void apply_config( Plugin* p )
 {
     taskbar *tb = (taskbar *)p->priv;
     if( tb->tooltips )
@@ -1490,7 +1489,7 @@ static void apply_config( plugin* p )
                           (gpointer)tb->icons_only );
 }
 
-static void taskbar_config( plugin* p, GtkWindow* parent )
+static void taskbar_config( Plugin* p, GtkWindow* parent )
 {
     GtkWidget* dlg;
     taskbar *tb = (taskbar *)p->priv;
@@ -1513,7 +1512,7 @@ static void taskbar_config( plugin* p, GtkWindow* parent )
     gtk_window_present( GTK_WINDOW(dlg) );
 }
 
-static void save_config( plugin* p, FILE* fp )
+static void save_config( Plugin* p, FILE* fp )
 {
     taskbar *tb = (taskbar *)p->priv;
     lxpanel_put_bool( fp, "tooltips", tb->tooltips );
@@ -1532,7 +1531,7 @@ static void
 update_label_orient( GtkWidget* child, gpointer user_data )
 {
     /* FIXME: gtk+ has only limited support for this, sigh! */
-    plugin* p = (plugin*)user_data;
+    Plugin* p = (Plugin*)user_data;
     if( GTK_IS_LABEL(child) ) {
         gdouble angle;
         if( p->panel->edge == EDGE_LEFT ) {
@@ -1556,7 +1555,7 @@ update_label_orient( GtkWidget* child, gpointer user_data )
     }
 }
 
-static void orientation_changed( plugin* p )
+static void orientation_changed( Plugin* p )
 {
     taskbar *tb = (taskbar *)p->priv;
     GList *child, *children;
@@ -1580,7 +1579,7 @@ static void orientation_changed( plugin* p )
     gtk_bar_set_orientation( GTK_BAR(tb->bar), p->panel->orientation );
 }
 
-plugin_class taskbar_plugin_class = {
+PluginClass taskbar_plugin_class = {
     fname: NULL,
     count: 0,
 
index 5c371b1..419daf8 100644 (file)
@@ -60,7 +60,7 @@ clock_update(gpointer data )
 
 
 static int
-test_constructor(plugin *p)
+test_constructor(Plugin *p)
 {
     test *dc;
     line s;
@@ -85,7 +85,7 @@ test_constructor(plugin *p)
 
 
 static void
-test_destructor(plugin *p)
+test_destructor(Plugin *p)
 {
   test *dc = (test *)p->priv;
 
@@ -97,7 +97,7 @@ test_destructor(plugin *p)
   RET();
 }
 
-plugin_class test_plugin_class = {
+PluginClass test_plugin_class = {
     fname: NULL,
     count: 0,
 
index a47285b..e5967b6 100644 (file)
@@ -44,7 +44,7 @@ typedef struct {
 } volume_t;
 
 static void
-volume_destructor(plugin *p)
+volume_destructor(Plugin *p)
 {
     volume_t *vol = (volume_t *) p->priv;
 
@@ -66,7 +66,7 @@ static void on_volume_focus (GtkWidget* dlg, GdkEventFocus *event, volume_t *vol
     vol->dlg = NULL;
 }
 
-static void on_button_press (GtkWidget* widget, GdkEventButton* evt, plugin* p)
+static void on_button_press (GtkWidget* widget, GdkEventButton* evt, Plugin* p)
 {
     volume_t *vol = (volume_t*) p->priv;
 
@@ -89,7 +89,7 @@ static void on_button_press (GtkWidget* widget, GdkEventButton* evt, plugin* p)
 }
 
 static int
-volume_constructor(plugin *p, char **fp)
+volume_constructor(Plugin *p, char **fp)
 {
     volume_t *vol;
     line s;
@@ -150,7 +150,7 @@ volume_constructor(plugin *p, char **fp)
 }
 
 
-plugin_class volume_plugin_class = {
+PluginClass volume_plugin_class = {
     fname: NULL,
     count: 0,
 
index a4b7c56..05a52ec 100644 (file)
@@ -146,7 +146,7 @@ static void click_mute(GtkWidget *widget, volume_t *vol)
     }
 }
 
-static void panel_init(plugin *p)
+static void panel_init(Plugin *p)
 {
     volume_t *vol = p->priv;
     GtkWidget *scrolledwindow;
@@ -223,7 +223,7 @@ static void panel_init(plugin *p)
 }
 
 static void
-volumealsa_destructor(plugin *p)
+volumealsa_destructor(Plugin *p)
 {
     volume_t *vol = (volume_t *) p->priv;
 
@@ -237,7 +237,7 @@ volumealsa_destructor(plugin *p)
 }
 
 static int
-volumealsa_constructor(plugin *p, char **fp)
+volumealsa_constructor(Plugin *p, char **fp)
 {
     volume_t *vol;
     line s;
@@ -296,7 +296,7 @@ volumealsa_constructor(plugin *p, char **fp)
 }
 
 
-plugin_class volumealsa_plugin_class = {
+PluginClass volumealsa_plugin_class = {
     fname: NULL,
     count: 0,
 
index f39e992..504489c 100644 (file)
@@ -51,7 +51,7 @@ toggle_shaded(wincmd *wc, guint32 action)
     Window *win = NULL;
     int num, i;
     guint32 tmp2, dno;
-    net_wm_window_type nwwt;
+    NetWMWindowType nwwt;
 
     ENTER;
     win = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_CLIENT_LIST, XA_WINDOW, &num);
@@ -98,7 +98,7 @@ toggle_iconify(wincmd *wc, guint32 action)
     Window *win = NULL;
     int num, i;
     guint32 tmp2, dno;
-    net_wm_window_type nwwt;
+    NetWMWindowType nwwt;
 
     ENTER;
     win = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_CLIENT_LIST, XA_WINDOW, &num);
@@ -162,7 +162,7 @@ clicked (GtkWidget *widget, GdkEventButton *event, gpointer data)
 }
 
 static void
-wincmd_destructor(plugin *p)
+wincmd_destructor(Plugin *p)
 {
     wincmd *wc = (wincmd *)p->priv;
 
@@ -176,7 +176,7 @@ wincmd_destructor(plugin *p)
 
 
 static int
-wincmd_constructor(plugin *p, char **fp)
+wincmd_constructor(Plugin *p, char **fp)
 {
     line s;
     gchar *fname;
@@ -267,7 +267,7 @@ wincmd_constructor(plugin *p, char **fp)
     RET(0);
 }
 
-static void save_config( plugin* p, FILE* fp )
+static void save_config( Plugin* p, FILE* fp )
 {
     wincmd* wc = (wincmd*)p->priv;
 
@@ -277,7 +277,7 @@ static void save_config( plugin* p, FILE* fp )
 }
 
 
-plugin_class wincmd_plugin_class = {
+PluginClass wincmd_plugin_class = {
     fname: NULL,
     count: 0,
 
diff --git a/src/plugins/xkb/Makefile.am b/src/plugins/xkb/Makefile.am
new file mode 100644 (file)
index 0000000..1da7e63
--- /dev/null
@@ -0,0 +1,101 @@
+INCLUDES = \
+       -I. \
+       -I$(top_srcdir)/src \
+       $(PACKAGE_CFLAGS) \
+       -DFLAGSDIR=\"$(datadir)/lxpanel/images/xkb-flags\"
+       $(G_CAST_CHECKS)
+
+module_LTLIBRARIES = xkb.la
+moduledir = $(libdir)/lxpanel/plugins
+
+xkb_la_SOURCES = \
+       xkb-plugin.c \
+       xkb.c \
+       xkb.h
+
+xkb_la_LIBADD = \
+       $(PACKAGE_LIBS)
+
+xkb_la_LDFLAGS = \
+       -module \
+       @LXPANEL_MODULE@
+
+flagsdir=$(datadir)/lxpanel/images/xkb-flags
+flags_DATA= \
+       flags/ae.png \
+       flags/am.png \
+       flags/ar.png \
+       flags/at.png \
+       flags/az.png \
+       flags/be.png \
+       flags/bg.png \
+       flags/bh.png \
+       flags/br.png \
+       flags/by.png \
+       flags/ca.png \
+       flags/ch.png \
+       flags/cu.png \
+       flags/cz.png \
+       flags/de.png \
+       flags/dj.png \
+       flags/dk.png \
+       flags/dz.png \
+       flags/ee.png \
+       flags/eg.png \
+       flags/es.png \
+       flags/eu.png \
+       flags/fi.png \
+       flags/fr.png \
+       flags/ge.png \
+       flags/gr.png \
+       flags/hr.png \
+       flags/hu.png \
+       flags/il.png \
+       flags/iq.png \
+       flags/is.png \
+       flags/it.png \
+       flags/jo.png \
+       flags/jp.png \
+       flags/km.png \
+       flags/kr.png \
+       flags/kw.png \
+       flags/la.png \
+       flags/lb.png \
+       flags/lt.png \
+       flags/ly.png \
+       flags/ma.png \
+       flags/mk.png \
+       flags/mn.png \
+       flags/mx.png \
+       flags/nl.png \
+       flags/no.png \
+       flags/om.png \
+       flags/pl.png \
+       flags/ps.png \
+       flags/pt.png \
+       flags/qa.png \
+       flags/qc.png \
+       flags/ro.png \
+       flags/ru.png \
+       flags/sa.png \
+       flags/sd.png \
+       flags/se.png \
+       flags/si.png \
+       flags/sk.png \
+       flags/so.png \
+       flags/sr.png \
+       flags/sy.png \
+       flags/th.png \
+       flags/tn.png \
+       flags/tr.png \
+       flags/ua.png \
+       flags/uk.png \
+       flags/un.png \
+       flags/us.png \
+       flags/uy.png \
+       flags/vn.png \
+       flags/ye.png \
+       flags/yu.png
+
+EXTRA_DIST =   \
+       $(flags_DATA)
diff --git a/src/plugins/xkb/flags/Makefile.am b/src/plugins/xkb/flags/Makefile.am
new file mode 100644 (file)
index 0000000..882d3aa
--- /dev/null
@@ -0,0 +1,78 @@
+flagsdir = $(datadir)/xfce4/xkb/flags
+
+flags_DATA = ae.png \
+                                 am.png \
+                                 ar.png \
+                                 at.png \
+                                 az.png \
+                                 be.png \
+                                 bg.png \
+                                 bh.png \
+                                 br.png \
+                                 by.png \
+                                 ca.png \
+                                 ch.png \
+                                 cu.png \
+                                 cz.png \
+                                 de.png \
+                                 dj.png \
+                                 dk.png \
+                                 dz.png \
+                                 ee.png \
+                                 eg.png \
+                                 es.png \
+                                 eu.png \
+                                 fi.png \
+                                 fr.png \
+                                 ge.png \
+                                 gr.png \
+                                 hr.png \
+                                 hu.png \
+                                 il.png \
+                                 iq.png \
+                                 is.png \
+                                 it.png \
+                                 jo.png \
+                                 jp.png \
+                                 km.png \
+                                 kr.png \
+                                 kw.png \
+                                 la.png \
+                                 lb.png \
+                                 lt.png \
+                                 ly.png \
+                                 ma.png \
+                                 mk.png \
+                                 mn.png \
+                                 mx.png \
+                                 nl.png \
+                                 no.png \
+                                 om.png \
+                                 pl.png \
+                                 ps.png \
+                                 pt.png \
+                                 qa.png \
+                                 qc.png \
+                                 ro.png \
+                                 ru.png \
+                                 sa.png \
+                                 sd.png \
+                                 se.png \
+                                 si.png \
+                                 sk.png \
+                                 so.png \
+                                 sr.png \
+                                 sy.png \
+                                 th.png \
+                                 tn.png \
+                                 tr.png \
+                                 ua.png \
+                                 uk.png \
+                                 un.png \
+                                 us.png \
+                                 uy.png \
+                                 vn.png \
+                                 ye.png \
+                                 yu.png
+
+EXTRA_DIST = $(flags_DATA)
diff --git a/src/plugins/xkb/flags/Makefile.in b/src/plugins/xkb/flags/Makefile.in
new file mode 100644 (file)
index 0000000..f67baa1
--- /dev/null
@@ -0,0 +1,482 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+subdir = flags
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(flagsdir)"
+flagsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(flags_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALL_LINGUAS = @ALL_LINGUAS@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+GTK_REQUIRED_VERSION = @GTK_REQUIRED_VERSION@
+GTK_VERSION = @GTK_VERSION@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@
+INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@
+INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_ICONV = @INTLTOOL_ICONV@
+INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@
+INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_MSGFMT = @INTLTOOL_MSGFMT@
+INTLTOOL_MSGMERGE = @INTLTOOL_MSGMERGE@
+INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@
+INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@
+INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@
+INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@
+INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@
+INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@
+INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@
+INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@
+INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@
+INTLTOOL_XGETTEXT = @INTLTOOL_XGETTEXT@
+INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@
+INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBX11_CFLAGS = @LIBX11_CFLAGS@
+LIBX11_LDFLAGS = @LIBX11_LDFLAGS@
+LIBX11_LIBS = @LIBX11_LIBS@
+LIBXFCE4PANEL_CFLAGS = @LIBXFCE4PANEL_CFLAGS@
+LIBXFCE4PANEL_LIBS = @LIBXFCE4PANEL_LIBS@
+LIBXFCE4PANEL_REQUIRED_VERSION = @LIBXFCE4PANEL_REQUIRED_VERSION@
+LIBXFCE4PANEL_VERSION = @LIBXFCE4PANEL_VERSION@
+LIBXFCE4UTIL_CFLAGS = @LIBXFCE4UTIL_CFLAGS@
+LIBXFCE4UTIL_LIBS = @LIBXFCE4UTIL_LIBS@
+LIBXFCE4UTIL_REQUIRED_VERSION = @LIBXFCE4UTIL_REQUIRED_VERSION@
+LIBXFCE4UTIL_VERSION = @LIBXFCE4UTIL_VERSION@
+LIBXFCEGUI4_CFLAGS = @LIBXFCEGUI4_CFLAGS@
+LIBXFCEGUI4_LIBS = @LIBXFCEGUI4_LIBS@
+LIBXFCEGUI4_REQUIRED_VERSION = @LIBXFCEGUI4_REQUIRED_VERSION@
+LIBXFCEGUI4_VERSION = @LIBXFCEGUI4_VERSION@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+POFILES = @POFILES@
+POSUB = @POSUB@
+PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
+PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_ARGS = @XGETTEXT_ARGS@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+flagsdir = $(datadir)/xfce4/xkb/flags
+flags_DATA = ae.png \
+                                 am.png \
+                                 ar.png \
+                                 at.png \
+                                 az.png \
+                                 be.png \
+                                 bg.png \
+                                 bh.png \
+                                 br.png \
+                                 by.png \
+                                 ca.png \
+                                 ch.png \
+                                 cu.png \
+                                 cz.png \
+                                 de.png \
+                                 dj.png \
+                                 dk.png \
+                                 dz.png \
+                                 ee.png \
+                                 eg.png \
+                                 es.png \
+                                 eu.png \
+                                 fi.png \
+                                 fr.png \
+                                 ge.png \
+                                 gr.png \
+                                 hr.png \
+                                 hu.png \
+                                 il.png \
+                                 iq.png \
+                                 is.png \
+                                 it.png \
+                                 jo.png \
+                                 jp.png \
+                                 km.png \
+                                 kr.png \
+                                 kw.png \
+                                 la.png \
+                                 lb.png \
+                                 lt.png \
+                                 ly.png \
+                                 ma.png \
+                                 mk.png \
+                                 mn.png \
+                                 mx.png \
+                                 nl.png \
+                                 no.png \
+                                 om.png \
+                                 pl.png \
+                                 ps.png \
+                                 pt.png \
+                                 qa.png \
+                                 qc.png \
+                                 ro.png \
+                                 ru.png \
+                                 sa.png \
+                                 sd.png \
+                                 se.png \
+                                 si.png \
+                                 sk.png \
+                                 so.png \
+                                 sr.png \
+                                 sy.png \
+                                 th.png \
+                                 tn.png \
+                                 tr.png \
+                                 ua.png \
+                                 uk.png \
+                                 un.png \
+                                 us.png \
+                                 uy.png \
+                                 vn.png \
+                                 ye.png \
+                                 yu.png
+
+EXTRA_DIST = $(flags_DATA)
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  flags/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  flags/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-flagsDATA: $(flags_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(flagsdir)" || $(MKDIR_P) "$(DESTDIR)$(flagsdir)"
+       @list='$(flags_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(flagsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(flagsdir)/$$f'"; \
+         $(flagsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(flagsdir)/$$f"; \
+       done
+
+uninstall-flagsDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(flags_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(flagsdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(flagsdir)/$$f"; \
+       done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+       for dir in "$(DESTDIR)$(flagsdir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-flagsDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-flagsDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+       distclean-generic distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-dvi \
+       install-dvi-am install-exec install-exec-am install-flagsDATA \
+       install-html install-html-am install-info install-info-am \
+       install-man install-pdf install-pdf-am install-ps \
+       install-ps-am install-strip installcheck installcheck-am \
+       installdirs maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
+       uninstall-am uninstall-flagsDATA
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/plugins/xkb/flags/ae.png b/src/plugins/xkb/flags/ae.png
new file mode 100644 (file)
index 0000000..1b77c21
Binary files /dev/null and b/src/plugins/xkb/flags/ae.png differ
diff --git a/src/plugins/xkb/flags/am.png b/src/plugins/xkb/flags/am.png
new file mode 100644 (file)
index 0000000..7b0d5f7
Binary files /dev/null and b/src/plugins/xkb/flags/am.png differ
diff --git a/src/plugins/xkb/flags/ar.png b/src/plugins/xkb/flags/ar.png
new file mode 100644 (file)
index 0000000..60167d9
Binary files /dev/null and b/src/plugins/xkb/flags/ar.png differ
diff --git a/src/plugins/xkb/flags/at.png b/src/plugins/xkb/flags/at.png
new file mode 100644 (file)
index 0000000..2af1e65
Binary files /dev/null and b/src/plugins/xkb/flags/at.png differ
diff --git a/src/plugins/xkb/flags/az.png b/src/plugins/xkb/flags/az.png
new file mode 100644 (file)
index 0000000..9d561fa
Binary files /dev/null and b/src/plugins/xkb/flags/az.png differ
diff --git a/src/plugins/xkb/flags/be.png b/src/plugins/xkb/flags/be.png
new file mode 100644 (file)
index 0000000..4252b21
Binary files /dev/null and b/src/plugins/xkb/flags/be.png differ
diff --git a/src/plugins/xkb/flags/bg.png b/src/plugins/xkb/flags/bg.png
new file mode 100644 (file)
index 0000000..7f929e6
Binary files /dev/null and b/src/plugins/xkb/flags/bg.png differ
diff --git a/src/plugins/xkb/flags/bh.png b/src/plugins/xkb/flags/bh.png
new file mode 100644 (file)
index 0000000..a234dfe
Binary files /dev/null and b/src/plugins/xkb/flags/bh.png differ
diff --git a/src/plugins/xkb/flags/br.png b/src/plugins/xkb/flags/br.png
new file mode 100644 (file)
index 0000000..ad76e45
Binary files /dev/null and b/src/plugins/xkb/flags/br.png differ
diff --git a/src/plugins/xkb/flags/by.png b/src/plugins/xkb/flags/by.png
new file mode 100644 (file)
index 0000000..a40f445
Binary files /dev/null and b/src/plugins/xkb/flags/by.png differ
diff --git a/src/plugins/xkb/flags/ca.png b/src/plugins/xkb/flags/ca.png
new file mode 100644 (file)
index 0000000..e24e3fd
Binary files /dev/null and b/src/plugins/xkb/flags/ca.png differ
diff --git a/src/plugins/xkb/flags/ch.png b/src/plugins/xkb/flags/ch.png
new file mode 100644 (file)
index 0000000..46f6202
Binary files /dev/null and b/src/plugins/xkb/flags/ch.png differ
diff --git a/src/plugins/xkb/flags/cu.png b/src/plugins/xkb/flags/cu.png
new file mode 100644 (file)
index 0000000..8afa1bd
Binary files /dev/null and b/src/plugins/xkb/flags/cu.png differ
diff --git a/src/plugins/xkb/flags/cz.png b/src/plugins/xkb/flags/cz.png
new file mode 100644 (file)
index 0000000..699a4f0
Binary files /dev/null and b/src/plugins/xkb/flags/cz.png differ
diff --git a/src/plugins/xkb/flags/de.png b/src/plugins/xkb/flags/de.png
new file mode 100644 (file)
index 0000000..6d0f503
Binary files /dev/null and b/src/plugins/xkb/flags/de.png differ
diff --git a/src/plugins/xkb/flags/dj.png b/src/plugins/xkb/flags/dj.png
new file mode 100644 (file)
index 0000000..81e6d07
Binary files /dev/null and b/src/plugins/xkb/flags/dj.png differ
diff --git a/src/plugins/xkb/flags/dk.png b/src/plugins/xkb/flags/dk.png
new file mode 100644 (file)
index 0000000..0d637dc
Binary files /dev/null and b/src/plugins/xkb/flags/dk.png differ
diff --git a/src/plugins/xkb/flags/dz.png b/src/plugins/xkb/flags/dz.png
new file mode 100644 (file)
index 0000000..9993cd9
Binary files /dev/null and b/src/plugins/xkb/flags/dz.png differ
diff --git a/src/plugins/xkb/flags/ee.png b/src/plugins/xkb/flags/ee.png
new file mode 100644 (file)
index 0000000..8bcdbf4
Binary files /dev/null and b/src/plugins/xkb/flags/ee.png differ
diff --git a/src/plugins/xkb/flags/eg.png b/src/plugins/xkb/flags/eg.png
new file mode 100644 (file)
index 0000000..f8c1a36
Binary files /dev/null and b/src/plugins/xkb/flags/eg.png differ
diff --git a/src/plugins/xkb/flags/es.png b/src/plugins/xkb/flags/es.png
new file mode 100644 (file)
index 0000000..1ed6e7a
Binary files /dev/null and b/src/plugins/xkb/flags/es.png differ
diff --git a/src/plugins/xkb/flags/eu.png b/src/plugins/xkb/flags/eu.png
new file mode 100644 (file)
index 0000000..61e2ff6
Binary files /dev/null and b/src/plugins/xkb/flags/eu.png differ
diff --git a/src/plugins/xkb/flags/fi.png b/src/plugins/xkb/flags/fi.png
new file mode 100644 (file)
index 0000000..4f098f5
Binary files /dev/null and b/src/plugins/xkb/flags/fi.png differ
diff --git a/src/plugins/xkb/flags/fr.png b/src/plugins/xkb/flags/fr.png
new file mode 100644 (file)
index 0000000..bd4e18a
Binary files /dev/null and b/src/plugins/xkb/flags/fr.png differ
diff --git a/src/plugins/xkb/flags/ge.png b/src/plugins/xkb/flags/ge.png
new file mode 100644 (file)
index 0000000..4fe01bd
Binary files /dev/null and b/src/plugins/xkb/flags/ge.png differ
diff --git a/src/plugins/xkb/flags/gr.png b/src/plugins/xkb/flags/gr.png
new file mode 100644 (file)
index 0000000..10431b8
Binary files /dev/null and b/src/plugins/xkb/flags/gr.png differ
diff --git a/src/plugins/xkb/flags/hr.png b/src/plugins/xkb/flags/hr.png
new file mode 100644 (file)
index 0000000..d65bcc5
Binary files /dev/null and b/src/plugins/xkb/flags/hr.png differ
diff --git a/src/plugins/xkb/flags/hu.png b/src/plugins/xkb/flags/hu.png
new file mode 100644 (file)
index 0000000..7fd5c9c
Binary files /dev/null and b/src/plugins/xkb/flags/hu.png differ
diff --git a/src/plugins/xkb/flags/il.png b/src/plugins/xkb/flags/il.png
new file mode 100644 (file)
index 0000000..e48e497
Binary files /dev/null and b/src/plugins/xkb/flags/il.png differ
diff --git a/src/plugins/xkb/flags/iq.png b/src/plugins/xkb/flags/iq.png
new file mode 100644 (file)
index 0000000..250f2b0
Binary files /dev/null and b/src/plugins/xkb/flags/iq.png differ
diff --git a/src/plugins/xkb/flags/is.png b/src/plugins/xkb/flags/is.png
new file mode 100644 (file)
index 0000000..85b9f3a
Binary files /dev/null and b/src/plugins/xkb/flags/is.png differ
diff --git a/src/plugins/xkb/flags/it.png b/src/plugins/xkb/flags/it.png
new file mode 100644 (file)
index 0000000..d515ffa
Binary files /dev/null and b/src/plugins/xkb/flags/it.png differ
diff --git a/src/plugins/xkb/flags/jo.png b/src/plugins/xkb/flags/jo.png
new file mode 100644 (file)
index 0000000..7c8d1f0
Binary files /dev/null and b/src/plugins/xkb/flags/jo.png differ
diff --git a/src/plugins/xkb/flags/jp.png b/src/plugins/xkb/flags/jp.png
new file mode 100644 (file)
index 0000000..984fc19
Binary files /dev/null and b/src/plugins/xkb/flags/jp.png differ
diff --git a/src/plugins/xkb/flags/km.png b/src/plugins/xkb/flags/km.png
new file mode 100644 (file)
index 0000000..d4ed3b4
Binary files /dev/null and b/src/plugins/xkb/flags/km.png differ
diff --git a/src/plugins/xkb/flags/kr.png b/src/plugins/xkb/flags/kr.png
new file mode 100644 (file)
index 0000000..43730b1
Binary files /dev/null and b/src/plugins/xkb/flags/kr.png differ
diff --git a/src/plugins/xkb/flags/kw.png b/src/plugins/xkb/flags/kw.png
new file mode 100644 (file)
index 0000000..893b433
Binary files /dev/null and b/src/plugins/xkb/flags/kw.png differ
diff --git a/src/plugins/xkb/flags/la.png b/src/plugins/xkb/flags/la.png
new file mode 100644 (file)
index 0000000..9000553
Binary files /dev/null and b/src/plugins/xkb/flags/la.png differ
diff --git a/src/plugins/xkb/flags/lb.png b/src/plugins/xkb/flags/lb.png
new file mode 100644 (file)
index 0000000..f4e7102
Binary files /dev/null and b/src/plugins/xkb/flags/lb.png differ
diff --git a/src/plugins/xkb/flags/lt.png b/src/plugins/xkb/flags/lt.png
new file mode 100644 (file)
index 0000000..d5ccfa9
Binary files /dev/null and b/src/plugins/xkb/flags/lt.png differ
diff --git a/src/plugins/xkb/flags/ly.png b/src/plugins/xkb/flags/ly.png
new file mode 100644 (file)
index 0000000..d2f1656
Binary files /dev/null and b/src/plugins/xkb/flags/ly.png differ
diff --git a/src/plugins/xkb/flags/ma.png b/src/plugins/xkb/flags/ma.png
new file mode 100644 (file)
index 0000000..0b3730e
Binary files /dev/null and b/src/plugins/xkb/flags/ma.png differ
diff --git a/src/plugins/xkb/flags/mk.png b/src/plugins/xkb/flags/mk.png
new file mode 100644 (file)
index 0000000..32cc584
Binary files /dev/null and b/src/plugins/xkb/flags/mk.png differ
diff --git a/src/plugins/xkb/flags/mn.png b/src/plugins/xkb/flags/mn.png
new file mode 100644 (file)
index 0000000..c4ce870
Binary files /dev/null and b/src/plugins/xkb/flags/mn.png differ
diff --git a/src/plugins/xkb/flags/mx.png b/src/plugins/xkb/flags/mx.png
new file mode 100644 (file)
index 0000000..f48cb27
Binary files /dev/null and b/src/plugins/xkb/flags/mx.png differ
diff --git a/src/plugins/xkb/flags/nl.png b/src/plugins/xkb/flags/nl.png
new file mode 100644 (file)
index 0000000..7c7b04d
Binary files /dev/null and b/src/plugins/xkb/flags/nl.png differ
diff --git a/src/plugins/xkb/flags/no.png b/src/plugins/xkb/flags/no.png
new file mode 100644 (file)
index 0000000..1fcf4b8
Binary files /dev/null and b/src/plugins/xkb/flags/no.png differ
diff --git a/src/plugins/xkb/flags/om.png b/src/plugins/xkb/flags/om.png
new file mode 100644 (file)
index 0000000..4d21089
Binary files /dev/null and b/src/plugins/xkb/flags/om.png differ
diff --git a/src/plugins/xkb/flags/pl.png b/src/plugins/xkb/flags/pl.png
new file mode 100644 (file)
index 0000000..cfadbe5
Binary files /dev/null and b/src/plugins/xkb/flags/pl.png differ
diff --git a/src/plugins/xkb/flags/ps.png b/src/plugins/xkb/flags/ps.png
new file mode 100644 (file)
index 0000000..d0f1c9c
Binary files /dev/null and b/src/plugins/xkb/flags/ps.png differ
diff --git a/src/plugins/xkb/flags/pt.png b/src/plugins/xkb/flags/pt.png
new file mode 100644 (file)
index 0000000..a805a3d
Binary files /dev/null and b/src/plugins/xkb/flags/pt.png differ
diff --git a/src/plugins/xkb/flags/qa.png b/src/plugins/xkb/flags/qa.png
new file mode 100644 (file)
index 0000000..e1cb69d
Binary files /dev/null and b/src/plugins/xkb/flags/qa.png differ
diff --git a/src/plugins/xkb/flags/qc.png b/src/plugins/xkb/flags/qc.png
new file mode 100644 (file)
index 0000000..c2b9c44
Binary files /dev/null and b/src/plugins/xkb/flags/qc.png differ
diff --git a/src/plugins/xkb/flags/ro.png b/src/plugins/xkb/flags/ro.png
new file mode 100644 (file)
index 0000000..3afd178
Binary files /dev/null and b/src/plugins/xkb/flags/ro.png differ
diff --git a/src/plugins/xkb/flags/ru.png b/src/plugins/xkb/flags/ru.png
new file mode 100644 (file)
index 0000000..33b2176
Binary files /dev/null and b/src/plugins/xkb/flags/ru.png differ
diff --git a/src/plugins/xkb/flags/sa.png b/src/plugins/xkb/flags/sa.png
new file mode 100644 (file)
index 0000000..759b86d
Binary files /dev/null and b/src/plugins/xkb/flags/sa.png differ
diff --git a/src/plugins/xkb/flags/sd.png b/src/plugins/xkb/flags/sd.png
new file mode 100644 (file)
index 0000000..d9249ce
Binary files /dev/null and b/src/plugins/xkb/flags/sd.png differ
diff --git a/src/plugins/xkb/flags/se.png b/src/plugins/xkb/flags/se.png
new file mode 100644 (file)
index 0000000..53d0344
Binary files /dev/null and b/src/plugins/xkb/flags/se.png differ
diff --git a/src/plugins/xkb/flags/si.png b/src/plugins/xkb/flags/si.png
new file mode 100644 (file)
index 0000000..f7287ab
Binary files /dev/null and b/src/plugins/xkb/flags/si.png differ
diff --git a/src/plugins/xkb/flags/sk.png b/src/plugins/xkb/flags/sk.png
new file mode 100644 (file)
index 0000000..e4517cb
Binary files /dev/null and b/src/plugins/xkb/flags/sk.png differ
diff --git a/src/plugins/xkb/flags/so.png b/src/plugins/xkb/flags/so.png
new file mode 100644 (file)
index 0000000..c740084
Binary files /dev/null and b/src/plugins/xkb/flags/so.png differ
diff --git a/src/plugins/xkb/flags/sr.png b/src/plugins/xkb/flags/sr.png
new file mode 100644 (file)
index 0000000..1f668f4
Binary files /dev/null and b/src/plugins/xkb/flags/sr.png differ
diff --git a/src/plugins/xkb/flags/sy.png b/src/plugins/xkb/flags/sy.png
new file mode 100644 (file)
index 0000000..f74e6b8
Binary files /dev/null and b/src/plugins/xkb/flags/sy.png differ
diff --git a/src/plugins/xkb/flags/th.png b/src/plugins/xkb/flags/th.png
new file mode 100644 (file)
index 0000000..1b55adf
Binary files /dev/null and b/src/plugins/xkb/flags/th.png differ
diff --git a/src/plugins/xkb/flags/tn.png b/src/plugins/xkb/flags/tn.png
new file mode 100644 (file)
index 0000000..9b57531
Binary files /dev/null and b/src/plugins/xkb/flags/tn.png differ
diff --git a/src/plugins/xkb/flags/tr.png b/src/plugins/xkb/flags/tr.png
new file mode 100644 (file)
index 0000000..395e0b7
Binary files /dev/null and b/src/plugins/xkb/flags/tr.png differ
diff --git a/src/plugins/xkb/flags/ua.png b/src/plugins/xkb/flags/ua.png
new file mode 100644 (file)
index 0000000..e981703
Binary files /dev/null and b/src/plugins/xkb/flags/ua.png differ
diff --git a/src/plugins/xkb/flags/uk.png b/src/plugins/xkb/flags/uk.png
new file mode 100644 (file)
index 0000000..486303c
Binary files /dev/null and b/src/plugins/xkb/flags/uk.png differ
diff --git a/src/plugins/xkb/flags/un.png b/src/plugins/xkb/flags/un.png
new file mode 100644 (file)
index 0000000..47c6f74
Binary files /dev/null and b/src/plugins/xkb/flags/un.png differ
diff --git a/src/plugins/xkb/flags/us.png b/src/plugins/xkb/flags/us.png
new file mode 100644 (file)
index 0000000..d10ca59
Binary files /dev/null and b/src/plugins/xkb/flags/us.png differ
diff --git a/src/plugins/xkb/flags/uy.png b/src/plugins/xkb/flags/uy.png
new file mode 100644 (file)
index 0000000..9990421
Binary files /dev/null and b/src/plugins/xkb/flags/uy.png differ
diff --git a/src/plugins/xkb/flags/vn.png b/src/plugins/xkb/flags/vn.png
new file mode 100644 (file)
index 0000000..3fc1c81
Binary files /dev/null and b/src/plugins/xkb/flags/vn.png differ
diff --git a/src/plugins/xkb/flags/ye.png b/src/plugins/xkb/flags/ye.png
new file mode 100644 (file)
index 0000000..be7080c
Binary files /dev/null and b/src/plugins/xkb/flags/ye.png differ
diff --git a/src/plugins/xkb/flags/yu.png b/src/plugins/xkb/flags/yu.png
new file mode 100644 (file)
index 0000000..9470101
Binary files /dev/null and b/src/plugins/xkb/flags/yu.png differ
diff --git a/src/plugins/xkb/xkb-plugin.c b/src/plugins/xkb/xkb-plugin.c
new file mode 100644 (file)
index 0000000..9f8e8c9
--- /dev/null
@@ -0,0 +1,507 @@
+/*
+//====================================================================
+//  xfce4-xkb-plugin - XFCE4 Xkb Layout Indicator panel plugin
+// -------------------------------------------------------------------
+//  Alexander Iliev <sasoiliev@mamul.org>
+//  20-Feb-04
+// -------------------------------------------------------------------
+//  Parts of this code belong to Michael Glickman <wmalms@yahooo.com>
+//  and his program wmxkb.
+//  WARNING: DO NOT BOTHER Michael Glickman WITH QUESTIONS ABOUT THIS
+//           PROGRAM!!! SEND INSTEAD EMAILS TO <sasoiliev@mamul.org>
+//====================================================================
+*/
+
+/* Modified by Hong Jen Yee (PCMan) <pcman.tw@gmail.com> on 2008-04-06 for lxpanel */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+
+#include <stdio.h>
+#include <ctype.h>
+
+#include "xkb.h"
+
+t_xkb_options_dlg *dlg = NULL;
+GIOChannel *channel;
+guint source_id;
+
+gulong win_change_hanler, win_close_hanler;
+
+static void
+xkb_free(t_xkb *xkb);
+
+static void
+xkb_save_config(t_xkb *xkb, gchar *filename);
+
+static t_xkb_options_dlg*
+xkb_options_dlg_create();
+
+static void
+free_xkb_options_dlg(GtkDialog *dialog, gint arg1, gpointer user_data);
+
+static void
+xkb_options_dlg_set_xkb(t_xkb_options_dlg *dlg, t_xkb *xkb);
+
+static void 
+change_group(GtkButton *btn, gpointer data) ;
+
+static void 
+active_window_changed(FbEv *ev, gpointer data) ;
+
+static void 
+application_closed( FbEv* ev, Window win, gpointer data) ;
+
+static void 
+xkb_refresh_gui(t_xkb *data) ;
+
+/* ------------------------------------------------------------------ *
+ *                     Panel Plugin Interface                         *
+ * ------------------------------------------------------------------ */
+
+static void 
+xkb_constructor (Plugin *plugin, char** fp);
+
+static void 
+xkb_destructor (Plugin *plugin);
+
+static void 
+xkb_orientation_changed(Plugin *plugin,
+                             GtkOrientation orientation,
+                             t_xkb *xkb);
+
+static gboolean 
+xkb_set_size(Plugin *plugin,gint size,
+                  t_xkb *xkb);
+
+static void 
+xkb_free_data(Plugin *plugin,t_xkb *xkb);
+
+static void 
+xkb_save(Plugin *plugin, t_xkb *xkb);
+
+static void 
+xkb_configure(Plugin *plugin, t_xkb *xkb);
+
+static void 
+xkb_about(Plugin *plugin, t_xkb *xkb);
+
+/* create widgets and connect to signals */
+static void 
+xkb_constructor (Plugin *plugin, char** fp)
+{
+  t_xkb *xkb;
+  line s;
+
+  const char *initial_group;
+
+  xkb = g_new(t_xkb, 1);
+
+  xkb->display_type = IMAGE;
+  xkb->enable_perapp = TRUE;
+  xkb->default_group = 0;
+
+    if( fp )
+    {
+        while (lxpanel_get_line(fp, &s) != LINE_BLOCK_END) {
+            if (s.type == LINE_NONE) {
+                ERR( "xkb: illegal token %s\n", s.str);
+                goto error;
+            }
+            if (s.type == LINE_VAR) {
+                if (!g_ascii_strcasecmp(s.t[0], "DisplayType"))
+                    xkb->display_type = atoi(s.t[1]);
+                else if (!g_ascii_strcasecmp(s.t[0], "PerAppLayout"))
+                    xkb->enable_perapp = str2num(bool_pair, s.t[1], 0);
+                else if (!g_ascii_strcasecmp(s.t[0], "DefaultGroup"))
+                    xkb->default_group = atoi(s.t[1]);
+                else {
+                    ERR( "xkb: unknown var %s\n", s.t[0]);
+                    goto error;
+                }
+            } else {
+                ERR( "xkb: illegal in this context %s\n", s.str);
+                goto error;
+            }
+        }
+    }
+
+  xkb->size = plugin->panel->height;
+
+  xkb->btn = gtk_button_new();
+  gtk_button_set_relief(GTK_BUTTON(xkb->btn), GTK_RELIEF_NONE);
+  // gtk_container_add(GTK_CONTAINER(xkb->plugin->pwid), xkb->btn);
+
+  gtk_widget_show(xkb->btn);
+  g_signal_connect(xkb->btn, "clicked", G_CALLBACK(change_group), xkb);
+
+  xkb->vbox = gtk_vbox_new(FALSE, 0);
+  gtk_container_add(GTK_CONTAINER(xkb->btn), xkb->vbox);
+
+  xkb->label = gtk_label_new("");
+  gtk_label_set_use_markup (GTK_LABEL (xkb->label), TRUE);
+  gtk_container_add(GTK_CONTAINER(xkb->vbox), xkb->label);
+  xkb->image = gtk_image_new();
+  gtk_container_add(GTK_CONTAINER(xkb->vbox), xkb->image);
+
+  gtk_widget_show(xkb->vbox);
+
+  initial_group = initialize_xkb(xkb);
+
+  xkb_refresh_gui(xkb);
+
+  channel = g_io_channel_unix_new(get_connection_number());
+  source_id = g_io_add_watch(channel, G_IO_IN | G_IO_PRI, 
+      (GIOFunc) &gio_callback, (gpointer) xkb);
+
+  /* track signals about window change */
+  win_change_hanler = g_signal_connect( G_OBJECT (fbev), 
+      "active_window", G_CALLBACK(active_window_changed), xkb);
+
+  win_close_hanler = g_signal_connect( G_OBJECT (fbev), 
+      "destroy_window", G_CALLBACK(application_closed), xkb);
+
+  gtk_widget_show_all(xkb->btn);
+
+  xkb->plugin = plugin;
+  plugin->priv = xkb;
+  plugin->pwid = xkb->btn;
+  
+    RET(1);
+error:
+       xkb_destructor( plugin );
+    RET(0);
+}
+
+static void 
+xkb_destructor (Plugin *plugin)
+{
+  t_xkb *xkb = (t_xkb*)plugin->priv;
+  xkb_free( xkb );
+}
+
+gboolean 
+xkb_set_size(Plugin *plugin, gint size,
+                  t_xkb *xkb)
+{
+  GtkOrientation orientation;
+  DBG ("setting size %d", size);
+  xkb->size = size;
+/*
+  orientation = xfce_panel_plugin_get_orientation (plugin);
+  if (orientation == GTK_ORIENTATION_HORIZONTAL)
+    gtk_widget_set_size_request(xkb->btn, -1, xkb->size);
+  else
+    gtk_widget_set_size_request(xkb->btn, xkb->size, -1);
+  */
+  set_new_locale(xkb);
+  return TRUE;
+}
+
+void 
+xkb_free_data(Plugin *plugin, t_xkb *xkb)
+{
+  xkb_free(xkb);
+}
+
+void xkb_save(Plugin *plugin, t_xkb *xkb)
+{
+  gchar *filename;
+//  filename = xfce_panel_plugin_save_location(plugin, TRUE);
+  if (filename)
+  {
+    xkb_save_config(xkb, filename);
+    g_free(filename);
+  }
+}
+
+void 
+xkb_configure(Plugin *plugin, t_xkb *xkb)
+{
+//  xfce_panel_plugin_block_menu(plugin); 
+  dlg = xkb_options_dlg_create();
+  xkb_options_dlg_set_xkb(dlg, xkb);
+  gtk_dialog_run(GTK_DIALOG(dlg->dialog));
+  //xfce_panel_plugin_unblock_menu(plugin);
+}
+
+void 
+xkb_about(Plugin *plugin, t_xkb *xkb)
+{
+  GtkWidget *about;
+  const gchar* authors[2] = {
+    "Alexander Iliev <sasoiliev@mamul.org>", 
+    NULL
+  };
+  about = gtk_about_dialog_new();
+  gtk_about_dialog_set_name(GTK_ABOUT_DIALOG(about), 
+      _("Keyboard Layout Switcher"));
+  gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(about), 
+      NULL);
+  gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(about), 
+      (const gchar**) authors);
+  gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(about), 
+      _("Allows you to switch the keyboard layout and\n"
+        "displays the currently selected layout."));
+  gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(about), 
+      "http://xfce-goodies.berlios.de");
+  gtk_about_dialog_set_website_label(GTK_ABOUT_DIALOG(about), 
+      _("Other plugins available here"));
+  gtk_dialog_run(GTK_DIALOG(about));
+  gtk_widget_destroy (about); 
+}
+
+/* ----------------- xkb plugin stuff -----------------------*/
+
+static void
+xkb_save_config(t_xkb *xkb, gchar *filename)
+{
+/*
+  XfceRc* rcfile = xfce_rc_simple_open(filename, FALSE);
+  if (!rcfile) 
+  {
+    return;
+  }
+
+  xfce_rc_set_group(rcfile, NULL);
+
+  xfce_rc_write_int_entry(rcfile, "display_type", 
+      xkb->display_type);
+  xfce_rc_write_int_entry(rcfile, "per_app_layout", 
+      (xkb->enable_perapp) ? 1 : 0);
+  xfce_rc_write_int_entry(rcfile, "default_group", 
+      xkb->default_group);
+
+  xfce_rc_close(rcfile);
+*/
+}
+
+void 
+active_window_changed(FbEv *ev, gpointer data) 
+{
+       Window *win = fb_ev_active_window( ev );
+       g_debug( "win = %p, pid=%d", win, get_net_wm_pid(win) );
+       if( win == None )
+               return;
+  react_active_window_changed(get_net_wm_pid( win ), (t_xkb *) data);
+}
+
+void 
+application_closed( FbEv* ev, Window win, gpointer data) 
+{
+       g_debug("win: %p", win);
+  react_application_closed(get_net_wm_pid(win));  
+}
+
+void 
+change_group(GtkButton *btn, gpointer data) 
+{
+  do_change_group(1, (t_xkb *) data);
+}
+
+void 
+xkb_refresh_gui(t_xkb *data) 
+{
+  t_xkb *plugin = (t_xkb *) data;
+
+  switch (plugin->display_type) 
+  {
+    case TEXT:
+      gtk_widget_hide(plugin->image);
+      gtk_widget_show(plugin->label);
+      break;
+    case IMAGE:
+      if (is_current_group_flag_available()) 
+      {
+        gtk_widget_hide(plugin->label);
+        gtk_widget_show(plugin->image);
+      }
+      break;
+    default: break;
+  }
+
+  /* Part of the image may remain visible after display type change */
+  gtk_widget_queue_draw_area(plugin->btn, 0, 0, 
+      plugin->size, plugin->size);
+}
+
+static void 
+xkb_free(t_xkb *xkb) 
+{
+  g_signal_handler_disconnect(fbev, win_change_hanler);
+//  g_signal_handler_disconnect(netk_screen, win_close_hanler);
+
+  g_source_remove(source_id);
+  deinitialize_xkb();
+
+  g_return_if_fail(xkb != NULL);
+
+  gtk_widget_destroy(xkb->btn);
+
+  g_free(xkb);
+}
+
+/* ----------------- xkb options dialog callbacks -----------------------*/
+
+static void 
+xkb_display_type_changed(GtkComboBox *cb, gpointer *data) 
+{
+  t_xkb *xkb = (t_xkb *) data;
+  xkb->display_type = gtk_combo_box_get_active(cb);
+  xkb_refresh_gui(xkb);
+}
+
+static void 
+xkb_enable_perapp_changed(GtkToggleButton *tb, gpointer *data) 
+{
+  t_xkb_options_dlg *dlg = (t_xkb_options_dlg *) data;
+  dlg->xkb->enable_perapp = gtk_toggle_button_get_active(tb);
+  gtk_widget_set_sensitive(dlg->per_app_default_layout_menu, 
+      dlg->xkb->enable_perapp);
+}
+
+static void 
+xkb_def_lang_changed(GtkComboBox *cb, gpointer *data) 
+{
+  t_xkb *xkb = (t_xkb *) data;
+  xkb->default_group = gtk_combo_box_get_active(cb);
+}
+
+/* ----------------- xkb options dialog -----------------------*/
+
+static t_xkb_options_dlg*
+xkb_options_dlg_create()
+{
+  int x;
+  GtkWidget *vbox, *hbox, *display_type_frame,
+            *per_app_frame, *alignment1, *alignment2, *hbox3, *label4;
+
+  dlg = g_new0(t_xkb_options_dlg, 1);
+
+  dlg->dialog = gtk_dialog_new_with_buttons (
+      _("Configure Keyboard Layout Switcher"), 
+      NULL,
+      GTK_DIALOG_NO_SEPARATOR,
+      GTK_STOCK_CLOSE, 
+      GTK_RESPONSE_OK,
+      NULL
+  );
+  vbox = gtk_vbox_new(FALSE, 2);
+  gtk_widget_show(vbox);
+  gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dlg->dialog)->vbox), vbox);
+
+  display_type_frame = gtk_frame_new (NULL);
+  gtk_frame_set_label (GTK_FRAME (display_type_frame), _("Show layout as"));
+  gtk_widget_show (display_type_frame);
+  gtk_box_pack_start (GTK_BOX (vbox), display_type_frame, TRUE, TRUE, 2);
+  gtk_container_set_border_width (GTK_CONTAINER (display_type_frame), 5);
+
+  alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_widget_show (alignment2);
+  gtk_container_add (GTK_CONTAINER (display_type_frame), alignment2);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 4, 4, 10, 10);
+  
+  hbox = gtk_hbox_new(FALSE, 2);
+  gtk_widget_show(hbox);
+  gtk_container_add (GTK_CONTAINER (alignment2), hbox);
+
+  dlg->display_type_optmenu = gtk_combo_box_new_text ();
+  gtk_combo_box_append_text (GTK_COMBO_BOX (dlg->display_type_optmenu), _("image"));
+  gtk_combo_box_append_text (GTK_COMBO_BOX (dlg->display_type_optmenu), _("text"));
+  gtk_box_pack_start(GTK_BOX(hbox), dlg->display_type_optmenu, TRUE, TRUE, 2);
+
+  per_app_frame = gtk_frame_new (NULL);
+  gtk_frame_set_label (GTK_FRAME (per_app_frame), _("Per application settings"));
+  gtk_widget_show (per_app_frame);
+  gtk_box_pack_start (GTK_BOX (vbox), per_app_frame, TRUE, TRUE, 2);
+  gtk_container_set_border_width (GTK_CONTAINER (per_app_frame), 5);
+
+  alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_widget_show (alignment1);
+  gtk_container_add (GTK_CONTAINER (per_app_frame), alignment1);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 4, 4, 10, 10);
+
+  dlg->per_app_vbox = gtk_vbox_new (FALSE, 2);
+  gtk_widget_show (dlg->per_app_vbox);
+  gtk_container_add (GTK_CONTAINER (alignment1), dlg->per_app_vbox);
+
+  dlg->per_app_checkbutton = gtk_check_button_new_with_mnemonic(_("_Remember layout for each application"));
+  gtk_widget_show (dlg->per_app_checkbutton);
+  gtk_box_pack_start (GTK_BOX (dlg->per_app_vbox), dlg->per_app_checkbutton, FALSE, FALSE, 2);
+  gtk_toggle_button_set_active((GtkToggleButton*) dlg->per_app_checkbutton, TRUE);
+
+  hbox3 = gtk_hbox_new (FALSE, 2);
+  gtk_widget_show (hbox3);
+  gtk_box_pack_start (GTK_BOX (dlg->per_app_vbox), hbox3, TRUE, TRUE, 2);
+
+  label4 = gtk_label_new (_("Default layout:"));
+  gtk_widget_show (label4);
+  gtk_box_pack_start (GTK_BOX (hbox3), label4, FALSE, FALSE, 2);
+
+  dlg->per_app_default_layout_menu = gtk_combo_box_new_text ();
+  gtk_widget_show (dlg->per_app_default_layout_menu);
+  gtk_box_pack_start (GTK_BOX (hbox3), dlg->per_app_default_layout_menu, FALSE, TRUE, 2);
+  
+  for (x = 0; x < get_group_count(); x++) 
+  {
+    gtk_combo_box_append_text(
+        GTK_COMBO_BOX(dlg->per_app_default_layout_menu), 
+        get_symbol_name_by_res_no(x));
+  }
+
+
+
+  gtk_widget_show_all(vbox);
+  
+  g_signal_connect_swapped( (gpointer)dlg->dialog, "response",
+                            G_CALLBACK (free_xkb_options_dlg), NULL);
+  
+  return dlg;
+}
+
+void
+free_xkb_options_dlg(GtkDialog *dialog, gint arg1, gpointer user_data)
+{
+  DBG("destroy options dialog\n");
+  gtk_widget_hide(dlg->dialog);
+  gtk_widget_destroy(dlg->dialog);
+  
+  g_free(dlg);
+  dlg = NULL;
+}
+
+static void
+xkb_options_dlg_set_xkb(t_xkb_options_dlg *dlg, t_xkb *xkb)
+{
+  dlg->xkb = xkb;
+
+  gtk_combo_box_set_active(GTK_COMBO_BOX(dlg->display_type_optmenu), xkb->display_type);
+
+  gtk_combo_box_set_active((GtkComboBox*)dlg->per_app_default_layout_menu, xkb->default_group);
+
+  gtk_toggle_button_set_active((GtkToggleButton*)dlg->per_app_checkbutton, xkb->enable_perapp);
+
+  g_signal_connect(dlg->display_type_optmenu, "changed", G_CALLBACK(xkb_display_type_changed), xkb);
+  g_signal_connect(dlg->per_app_checkbutton, "toggled", G_CALLBACK(xkb_enable_perapp_changed), dlg);
+  g_signal_connect(dlg->per_app_default_layout_menu, "changed", G_CALLBACK(xkb_def_lang_changed), xkb);
+}
+
+
+PluginClass xkb_plugin_class = {
+    fname: NULL,
+    count: 0,
+
+    type : "xkb",
+    name : N_("Kayboard Layout switcher"),
+    version: "1.0",
+    description : N_("Switch between available keyboard layouts"),
+
+    constructor : xkb_constructor,
+    destructor  : xkb_destructor,
+//    config : xkb_config,
+//    save : save_config,
+};
diff --git a/src/plugins/xkb/xkb.c b/src/plugins/xkb/xkb.c
new file mode 100644 (file)
index 0000000..f287eb9
--- /dev/null
@@ -0,0 +1,555 @@
+/*
+// ====================================================================
+//  xfce4-xkb-plugin - XFCE4 Xkb Layout Indicator panel plugin
+// -------------------------------------------------------------------
+//  Alexander Iliev <sasoiliev@mamul.org>
+//  20-Feb-04
+// -------------------------------------------------------------------
+//  Parts of this code belong to Michael Glickman <wmalms@yahooo.com>
+//  and his program wmxkb.
+//  WARNING: DO NOT BOTHER Michael Glickman WITH QUESTIONS ABOUT THIS
+//           PROGRAM!!! SEND INSTEAD EMAILS TO <sasoiliev@mamul.org>
+//====================================================================
+*/
+
+/* Modified by Hong Jen Yee (PCMan) <pcman.tw@gmail.com> on 2008-04-06 for lxpanel */
+
+#include "xkb.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <X11/XKBlib.h>
+
+#include <gtk/gtk.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <glib.h>
+
+Display *dsp;
+
+int group_title_source;
+int group_code_count;
+Bool flexy_groups;
+char **group_codes;
+char **custom_names;
+
+static int base_event_code;
+static int base_error_code;
+
+static int device_id;
+
+int current_group_xkb_no, current_group_res_no;
+int group_count;
+
+char *group_names[XkbNumKbdGroups];
+char *symbol_names[XkbNumKbdGroups];
+
+GHashTable* pGroupHash = NULL;
+
+gint 
+get_group_count() 
+{ 
+  return group_count;
+}
+
+static int 
+group_lookup(int source_value, char *from_texts[], char *to_texts[], int count) 
+{
+  if (flexy_groups) {
+    const char *source_text = from_texts[source_value];
+
+    if (source_text != NULL) {
+      const char *target_text;
+      int i;
+
+      for (i=0; i<count; i++) {
+        target_text = to_texts[i];
+        if (strcasecmp(source_text, target_text) == 0) {
+          source_value = i;
+          break;
+        }
+      }
+    }
+  }
+
+  return source_value;
+
+}
+
+static int 
+group_xkb_to_res(int group_xkb_no)
+{
+  return group_lookup(group_xkb_no, symbol_names, group_codes, group_code_count);
+}
+
+static int 
+group_no_res_to_xkb(int group_res_no) 
+{
+  return group_lookup(group_res_no, group_codes, symbol_names, group_count);
+}
+
+static const char * 
+get_group_name_by_res_no(int group_res_no) 
+{
+  return group_names[group_no_res_to_xkb(group_res_no)];
+}
+
+const char * 
+get_symbol_name_by_res_no(int group_res_no) 
+{
+  return symbol_names[group_no_res_to_xkb(group_res_no)];
+}
+
+static char *
+get_current_group_name(void) 
+{
+  const char *tmp = get_symbol_name_by_res_no(current_group_xkb_no);
+  return g_utf8_strdown (tmp, -1);
+}
+
+void 
+accomodate_group_xkb(void) 
+{
+  XkbStateRec xkb_state;
+  XkbGetState(dsp, device_id, &xkb_state);
+  current_group_xkb_no = xkb_state.group;
+
+  current_group_res_no = group_xkb_to_res(current_group_xkb_no);
+}
+
+int 
+do_init_xkb() 
+{
+  const Atom *group_source;
+  Bool status;
+  int major, minor, oppcode;
+  int i;
+  XkbStateRec xkb_state;
+  XkbDescRec *kbd_desc_ptr = NULL;
+  const Atom *tmp_group_source;
+  Atom cur_group_atom;
+  Atom sym_name_atom;
+  char *ptr;
+  char *sym_name;
+  char *ptr1;
+  int  count;
+
+  /* create hash asap, so it'll be ready when events arrive */
+  pGroupHash = g_hash_table_new(g_direct_hash, NULL);
+
+
+  /* Initialize the Xkb extension */
+  status = XkbQueryExtension(dsp, &oppcode,
+      &base_event_code, &base_error_code, &major, &minor);
+
+  device_id = XkbUseCoreKbd;
+
+  kbd_desc_ptr = XkbAllocKeyboard();
+  if (kbd_desc_ptr == NULL) {
+    fprintf(stderr, "Failed to get keyboard description\n");
+    goto HastaLaVista;
+  }
+
+  kbd_desc_ptr->dpy = dsp;
+  if (device_id != XkbUseCoreKbd) kbd_desc_ptr->device_spec = device_id;
+
+  XkbGetControls(dsp, XkbAllControlsMask, kbd_desc_ptr);
+  XkbGetNames(dsp, XkbSymbolsNameMask, kbd_desc_ptr);
+  XkbGetNames(dsp, XkbGroupNamesMask, kbd_desc_ptr);
+
+  if (kbd_desc_ptr->names == NULL) {
+    fprintf(stderr, "Failed to get keyboard description\n");
+    goto HastaLaVista;
+  }
+
+  group_source = kbd_desc_ptr->names->groups;
+
+  /* And more bug patches ! */
+  if (kbd_desc_ptr->ctrls != NULL) {
+    group_count = kbd_desc_ptr->ctrls->num_groups;
+  } else {
+    for (group_count=0;
+        group_count<XkbNumKbdGroups && group_source[group_count] != None;
+        group_count++);
+  }
+
+  if (group_count == 0) group_count=1;
+
+  for (i = 0; i < group_count; i++) {
+    group_names[i] = NULL;
+    symbol_names[i] = NULL;
+  }
+
+  tmp_group_source = kbd_desc_ptr->names->groups;
+
+  for (i = 0; i < group_count; i++) {
+    if ((cur_group_atom = tmp_group_source[i]) != None) {
+      group_names[i] = ptr = XGetAtomName(dsp, cur_group_atom);
+      if (ptr != NULL && (ptr=strchr(ptr, '(')) != NULL)
+        *ptr = '\0';
+    }
+  }
+  sym_name_atom = kbd_desc_ptr->names->symbols;
+  if (sym_name_atom == None ||
+      (sym_name = XGetAtomName(dsp, sym_name_atom)) == NULL) return 0;
+
+  count = 0;
+
+  for(ptr = strtok(sym_name, "+"); ptr != NULL; ptr = strtok(NULL, "+")) {
+    ptr1 = strchr(ptr, '(');
+    if (ptr1 != NULL) *ptr1 = '\0';
+    ptr1 = strchr(ptr, '_');
+    if (ptr1 != NULL && !g_ascii_isupper((int) *(ptr1+1))) *ptr1 = '\0';
+    ptr1 = strchr(ptr, ':');
+    if (ptr1 != NULL) *ptr1 = '\0';
+
+    ptr1 = strrchr(ptr, '/');
+    if (ptr1 != NULL) {
+      /* Filter out cases like pc/pc */
+      if (memcmp(ptr, ptr1+1, ptr1-ptr) == 0) continue;
+
+      ptr = ptr1+1;
+    }
+
+    if (strncmp(ptr, "group", 5) == 0) continue;
+        if (strncmp(ptr, "inet", 4) == 0) continue;
+        /* Filter cases like pc(pc105) (Xorg 7.0 update) */
+        if (strncmp(ptr, "pc", 2) == 0) continue;
+        
+    symbol_names[count++] = g_utf8_strup(ptr, -1);
+  }
+
+  if (count == 1 && group_names[0] == NULL &&
+      strcmp(symbol_names[0], "jp") == 0) {
+    group_count = 2;
+    symbol_names[1] = symbol_names[0];
+    symbol_names[0] = strdup("us");
+    group_names[0] = strdup("US/ASCII");
+    group_names[1] = strdup("Japanese");
+  } else {
+    if (count<group_count) {
+      int j=count, k=group_count;
+      while(--j>=0) symbol_names[--k] = symbol_names[j];
+      while(--k>=0) symbol_names[k] = strdup("en_US");
+    }
+  }
+
+  count = (group_title_source == 2) ? group_code_count : group_count;
+
+  for (i = 0; i < count; i++) {
+    if (flexy_groups && group_codes[i] == NULL) {
+      fprintf(stderr, "\nCode is not specified for Group %i !\n", i+1);
+      fprintf(stderr, "Flexy mode is ignored\n");
+      flexy_groups = False;
+    }
+
+    switch(group_title_source) {
+      case 1: /* Group name */
+        if (group_names[i] == NULL) {
+          const char *name = get_symbol_name_by_res_no(i);
+          if (name == NULL) name = "U/A";
+          fprintf(stderr, "\nGroup Name %i is undefined, set to '%s' !\n", i+1, name);
+          group_names[i] = strdup(name);
+        }
+        break;
+
+      case 2: /* Gustom name */
+        if (custom_names[i] == NULL) {
+          const char *name = get_symbol_name_by_res_no(i);
+          if (name == NULL) name = get_group_name_by_res_no(i);
+          if (name == NULL) name = "U/A";
+          fprintf(stderr, "\nCustom Name %i is undefined, set to '%s' !\n", i+1, name);
+          custom_names[i] = strdup(name);
+        }
+        break;
+
+      default: /* Symbolic name (0), No title source but can be used for images (3) */
+        if (symbol_names[i] == NULL) {
+          fprintf(stderr, "\nGroup Symbol %i is undefined, set to 'U/A' !\n", i+1);
+          symbol_names[i] = strdup("U/A");
+        }
+        break;
+    }
+  }
+
+  XkbGetState(dsp, device_id, &xkb_state);
+  current_group_xkb_no = xkb_state.group;
+
+  status = True;
+
+HastaLaVista:
+  if (kbd_desc_ptr) XkbFreeKeyboard(kbd_desc_ptr, 0, True);
+  return status;
+}
+
+gboolean temporary_changed_display_type = FALSE;
+
+gboolean 
+is_current_group_flag_available(void) 
+{
+  char *filename;
+  gboolean result = FALSE;
+  GdkPixbuf *tmp = NULL;
+  char *group_name = get_current_group_name();
+  filename = g_strdup_printf("%s/%s.png", FLAGSDIR, group_name);
+  DBG ("Try to load image: %s", filename);
+  tmp = gdk_pixbuf_new_from_file(filename, NULL);
+  g_free(filename);
+  g_free (group_name);
+  result = (gboolean) (tmp != NULL);
+  if (tmp)
+    g_object_unref(G_OBJECT (tmp));
+  return result;
+}
+
+char *
+xkb_get_label_markup(t_xkb *xkb)
+{
+  int font_desc;
+  if (xkb->size < 20) 
+    font_desc = 4;
+  else if (xkb->size >= 20 && xkb->size < 26)
+    font_desc = 6;
+  else if (xkb->size >= 26 && xkb->size < 32)
+    font_desc = 10;
+  else if (xkb->size >= 32 && xkb->size < 40)
+    font_desc = 12;
+  else if (xkb->size >= 40 && xkb->size < 52)
+    font_desc = 14;
+  else if (xkb->size >= 52 && xkb->size < 62)
+    font_desc = 16;
+  else if (xkb->size >= 62 && xkb->size < 70)
+    font_desc = 18;
+  else if (xkb->size >= 70 && xkb->size < 86)
+    font_desc = 20;
+  else if (xkb->size >= 86 && xkb->size < 100)
+    font_desc = 24;
+  else if (xkb->size >= 100 && xkb->size < 112)
+    font_desc = 28;
+  else if (xkb->size >= 112 && xkb->size < 124)
+    font_desc = 36;
+  else if (xkb->size >= 124)
+    font_desc = 48;
+
+  return g_markup_printf_escaped ("<span font_desc=\"%d\">%s</span>", font_desc, get_symbol_name_by_res_no (current_group_xkb_no));
+}
+
+void 
+set_new_locale(t_xkb *ctrl) 
+{
+  t_xkb *plugin = (t_xkb *) ctrl;
+  char *filename;
+  char *label_markup;
+  char *group_name;
+  int size;
+  GdkPixbuf *pixbuf = NULL, *tmp = NULL;
+  gint pid;
+
+  /* Set the label   */
+  label_markup = xkb_get_label_markup (plugin); 
+  gtk_label_set_markup (GTK_LABEL (plugin->label), label_markup);
+  g_free(label_markup);
+  
+  /* Set the image */
+  size = 0.9 * plugin->size;
+  group_name = get_current_group_name();
+  filename = g_strdup_printf("%s/%s.png", FLAGSDIR, group_name);
+  DBG ("Try to load image: %s", filename);
+  tmp = gdk_pixbuf_new_from_file(filename, NULL);
+  g_free(filename);
+  g_free(group_name);
+  if (tmp == NULL) { /* could not be loaded for some reason */
+    if (plugin->display_type == IMAGE) {
+      temporary_changed_display_type = TRUE;
+      gtk_widget_hide(plugin->image);
+      gtk_widget_show(plugin->label);
+    }
+  } else { /* loaded successfully */
+    temporary_changed_display_type = TRUE;
+    pixbuf = gdk_pixbuf_scale_simple(tmp, size, size - (int) (size / 3), GDK_INTERP_BILINEAR);
+    gtk_image_set_from_pixbuf((GtkImage *) plugin->image, pixbuf);
+    if (tmp)
+      g_object_unref(G_OBJECT(tmp));
+      
+    if (pixbuf)
+      g_object_unref(G_OBJECT(pixbuf));
+
+    if (plugin->display_type == IMAGE) { 
+      /* the image for the previous active layout could not be loaded */
+      gtk_widget_hide(plugin->label);
+      gtk_widget_show(plugin->image);
+    }
+  }
+
+  /* Part of the image may remain visible after image or display type change */
+  gtk_widget_queue_draw_area(plugin->btn, 0, 0, plugin->size, plugin->size);
+
+  /* "locale per process" */
+  /* TBF:: bad here, it's not really a "window" related file */
+  if (pGroupHash && fb_ev_active_window( fbev ) != None )
+  {
+    pid = get_net_wm_pid( fb_ev_active_window( fbev ) );
+    DBG("Storing locale %s for %d\n", get_symbol_name_by_res_no(current_group_xkb_no), pid);
+
+    g_hash_table_insert(pGroupHash, GINT_TO_POINTER(pid), GINT_TO_POINTER(current_group_xkb_no));
+  }
+}
+
+void 
+handle_xevent(t_xkb *ctrl)
+{
+  XkbEvent evnt;
+  int new_group_no;
+
+  XNextEvent(dsp, &evnt.core);
+  if (evnt.type == base_event_code) {
+
+    if (evnt.any.xkb_type == XkbStateNotify &&
+        (new_group_no = evnt.state.group) != current_group_xkb_no) {
+      current_group_xkb_no = new_group_no;
+      accomodate_group_xkb();
+      set_new_locale(ctrl);
+    }
+  }
+}
+
+const char * 
+initialize_xkb(t_xkb *ctrl) 
+{
+  XkbStateRec state;
+  int event_code, error_rtrn, major, minor, reason_rtrn;
+  char * display_name;
+  const char *group;
+
+  major = XkbMajorVersion;
+  minor = XkbMinorVersion;
+
+  display_name = "";
+  XkbIgnoreExtension(False);
+  dsp = XkbOpenDisplay(display_name, &event_code, &error_rtrn, &major, &minor, &reason_rtrn);
+
+  switch (reason_rtrn) {
+    case XkbOD_BadLibraryVersion:
+      fprintf(stderr, "Bad XKB library version.\n");
+      return NULL;
+    case XkbOD_ConnectionRefused:
+      fprintf(stderr, "Connection to X server refused.\n");
+      return NULL;
+    case XkbOD_BadServerVersion:
+      fprintf(stderr, "Bad X server version.\n");
+      return NULL;
+    case XkbOD_NonXkbServer:
+      fprintf(stderr, "XKB not present.\n");
+      return NULL;
+    case XkbOD_Success:
+      break;
+  }
+
+  if (do_init_xkb() != True) return "N/A";
+
+  group = get_symbol_name_by_res_no(current_group_xkb_no);
+
+  XkbSelectEventDetails(dsp, XkbUseCoreKbd, XkbStateNotify,
+      XkbAllStateComponentsMask, XkbGroupStateMask);
+
+  XkbGetState(dsp, device_id, &state);
+  current_group_xkb_no = (current_group_xkb_no != state.group) ? state.group : current_group_xkb_no;
+  accomodate_group_xkb();
+
+  if (ctrl != NULL) set_new_locale(ctrl);
+
+  return group;
+}
+
+static void 
+deinit_group_names() 
+{
+  int i;
+  for (i=0; i< group_count; i++) {
+    if (group_names[i] != NULL) {
+      free(group_names[i]);
+      group_names[i] = NULL;
+    }
+    if (symbol_names[i] != NULL) {
+      free(symbol_names[i]);
+      symbol_names[i] = NULL;
+    }
+  }
+}
+
+void 
+deinitialize_xkb() 
+{
+  deinit_group_names();
+  XCloseDisplay(dsp);
+  dsp = NULL;
+
+  g_hash_table_destroy(pGroupHash);
+  pGroupHash = NULL;
+}
+
+int 
+get_connection_number()
+{
+  return ConnectionNumber(dsp);
+}
+
+/* Sets the kb layout to the next layout */
+int 
+do_change_group(int increment, t_xkb *ctrl) 
+{
+  if (group_count <= 1) return 0;
+  XkbLockGroup(dsp, device_id,
+      (current_group_xkb_no + group_count + increment) % group_count); 
+      /* why not simply (current_group_xkb_no + increment) % group_count ? */
+  handle_xevent(ctrl);
+  return 1;
+}
+
+int 
+do_set_group(int group, t_xkb *ctrl) 
+{
+  if (group >= group_count)
+    return 0;
+  
+  XkbLockGroup(dsp, device_id, group);
+  accomodate_group_xkb();
+  set_new_locale(ctrl);
+
+  return 1;
+}
+
+gboolean 
+gio_callback(GIOChannel *source, GIOCondition condition, gpointer data) 
+{
+  handle_xevent((t_xkb *) data);
+  return TRUE;
+}
+
+void 
+react_active_window_changed(gint pid, t_xkb *ctrl)
+{
+  if (ctrl->enable_perapp)
+  {
+    gpointer pKey=0, pVal=0;
+    gint new_group_xkb_no = ctrl->default_group;
+
+    if (pGroupHash && g_hash_table_lookup_extended(pGroupHash, GINT_TO_POINTER(pid), &pKey, &pVal))
+      new_group_xkb_no = GPOINTER_TO_INT(pVal);
+
+    do_set_group(new_group_xkb_no, ctrl);
+  }
+}
+
+/* TODO: destroy hashtable if perapp layout is disabled? */
+void 
+react_application_closed(gint pid)
+{
+       g_debug( "pid = %d", pid );
+  if ( pid && pGroupHash) {
+    g_hash_table_remove(pGroupHash, GINT_TO_POINTER(pid));
+  }
+}
+
diff --git a/src/plugins/xkb/xkb.h b/src/plugins/xkb/xkb.h
new file mode 100644 (file)
index 0000000..6d26639
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+//====================================================================
+//  xfce4-xkb-plugin - XFCE4 Xkb Layout Indicator panel plugin
+// -------------------------------------------------------------------
+//  Alexander Iliev <sasoiliev@mamul.org>
+//  20-Feb-04
+// -------------------------------------------------------------------
+//  Parts of this code belong to Michael Glickman <wmalms@yahooo.com>
+//  and his program wmxkb.
+//  WARNING: DO NOT BOTHER Michael Glickman WITH QUESTIONS ABOUT THIS
+//           PROGRAM!!! SEND INSTEAD EMAILS TO <sasoiliev@mamul.org>
+//====================================================================
+*/
+
+/* Modified by Hong Jen Yee (PCMan) <pcman.tw@gmail.com> on 2008-04-06 for lxpanel */
+
+#ifndef _XKB_PLUGIN_H_
+#define _XKB_PLUGIN_H_
+
+#include <X11/Xlib.h>
+#include <gtk/gtk.h>
+#include <glib.h>
+
+#include "plugin.h"
+#include "misc.h"
+#include "panel.h"
+#include "ev.h"        /* for fbev */
+
+#include "dbg.h"
+
+#define ICONSIZETINY 24 
+#define ICONSIZESMALL 30
+#define ICONSIZEMEDIUM 45
+#define ICONSIZELARGE 60
+
+typedef enum 
+{
+  IMAGE = 0,
+  TEXT = 1
+} t_display_type;
+
+typedef struct 
+{
+  Plugin *plugin;
+
+  /* options */
+  gint size;                    /* plugin size */
+  t_display_type display_type;  /* display layout as image ot text */
+  gboolean enable_perapp;       /* enable per application (window) layout) */
+  gint default_group;           /* default group for "locale per process" */
+
+  /* widgets */
+  GtkWidget *ebox;
+  GtkWidget *btn;
+  GtkWidget *label;
+  GtkWidget *image;
+  GtkWidget *vbox;
+  GtkWidget *def_lang_menu;
+} t_xkb;
+
+typedef struct
+{
+  t_xkb *xkb;
+
+  GtkWidget *dialog;
+
+  /* display type menu */
+  GtkWidget *display_type_optmenu;    
+  GtkWidget *display_type_menu_label_text;
+  GtkWidget *display_type_menu_label_image;
+  /* layout per application options */
+  GtkWidget *per_app_frame;
+  GtkWidget *per_app_vbox;
+  GtkWidget *per_app_checkbutton;
+  GtkWidget *per_app_default_layout_menu;
+} t_xkb_options_dlg;
+
+void set_new_locale(t_xkb *ctrl);
+const char *initialize_xkb(t_xkb *ctrl);
+void deinitialize_xkb();
+void react_application_closed(gint pid);
+gint get_group_count();
+const char * get_symbol_name_by_res_no(int group_res_no);
+
+int do_change_group(int increment, t_xkb *ctrl);
+gboolean gio_callback(GIOChannel *source, GIOCondition condition, gpointer data);
+int get_connection_number();
+gboolean is_current_group_flag_available(void);
+/* "locale per process" functions */
+void react_active_window_changed(gint pid, t_xkb *ctrl);
+void react_window_closed(gint pid);
+int do_set_group(gint group, t_xkb *ctrl);
+
+#endif
+
index 10468b9..c7de8ba 100644 (file)
@@ -19,7 +19,7 @@
 
 
 typedef struct {
-    plugin *plug;
+    Plugin *plug;
     GtkWidget *box;
     NaTrayManager *tray_manager;
     int icon_num;
@@ -95,7 +95,7 @@ message_cancelled (NaTrayManager *manager, GtkWidget *icon, glong id,
 
 
 static void
-tray_destructor(plugin *p)
+tray_destructor(Plugin *p)
 {
     tray *tr = (tray *)p->priv;
 
@@ -112,7 +112,7 @@ tray_destructor(plugin *p)
 
 
 static int
-tray_constructor(plugin *p, char** fp)
+tray_constructor(Plugin *p, char** fp)
 {
     line s;
     tray *tr;
@@ -165,7 +165,7 @@ tray_constructor(plugin *p, char** fp)
 
 }
 
-static void orientation_changed( plugin* p )
+static void orientation_changed( Plugin* p )
 {
     tray *tr = (tray *)p->priv;
     GtkBox* newbox;
@@ -182,7 +182,7 @@ static void orientation_changed( plugin* p )
     force_redraw(tr);
 }
 
-plugin_class tray_plugin_class = {
+PluginClass tray_plugin_class = {
     fname: NULL,
     count: 0,