aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormallum <mallum@b067294f-1dea-0310-9683-c47a78595994>2004-12-23 16:05:22 +0000
committermallum <mallum@b067294f-1dea-0310-9683-c47a78595994>2004-12-23 16:05:22 +0000
commit578c227b71fd30abe6262d54b661df83bf497192 (patch)
treee5cbbe9df82356e986548da342800be16adb14f0
parent9b1f008ee6bd29abf3675bcf4feca5404c55d851 (diff)
downloadmb-applet-input-manager-578c227b71fd30abe6262d54b661df83bf497192.tar.gz
mb-applet-input-manager-578c227b71fd30abe6262d54b661df83bf497192.tar.bz2
mb-applet-input-manager-578c227b71fd30abe6262d54b661df83bf497192.zip
See Changelog
git-svn-id: https://svn.o-hand.com/repos/matchbox/trunk/mb-applet-input-manager@983 b067294f-1dea-0310-9683-c47a78595994
-rw-r--r--ChangeLog9
-rwxr-xr-xautogen.sh43
-rw-r--r--configure.ac4
-rw-r--r--mbinputmgr-tray.c51
4 files changed, 65 insertions, 42 deletions
diff --git a/ChangeLog b/ChangeLog
index e69de29..11130ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -0,0 +1,9 @@
+2004-12-23 mallum,,, <mallum@openedhand.com>
+
+ * autogen.sh:
+ Update
+ * configure.ac:
+ Bump up version
+ * mbinputmgr-tray.c: (paint_callback), (button_callback),
+ (load_icon), (main):
+ Fix potential segv. Add X CLient Message Activation.
diff --git a/autogen.sh b/autogen.sh
index d175662..b1376df 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,40 +1,3 @@
-#!/bin/sh
-
-dir=`echo "$0" | sed 's,[^/]*$,,'`
-test "x${dir}" = "x" && dir='.'
-
-if test "x`cd "${dir}" 2>/dev/null && pwd`" != "x`pwd`"
-then
- echo "this script must be executed directly from the source directory."
- exit 1
-fi
-
- # this might not be necessary with newer autotools:
-rm -f config.cache
-
-# older crap way
-#aclocal
-#autoconf
-#autoheader
-#automake -a -c
-
-echo "Running:"
-echo "- libtoolize" && \
-libtoolize --copy --force --automake && \
-echo "- aclocal" && \
-aclocal-1.4 && \
-echo "- autoconf" && \
-autoconf && \
-echo "- autoheader" && \
-autoheader && \
-echo "- automake" && \
-automake-1.4 --add-missing --gnu && \
-echo && \
-echo "Now run ./configure [options] and then make." && \
-echo && \
-exit 0
-
-#echo "Running ./configure ..." && \
-#./configure "$@"
-
-exit 1 \ No newline at end of file
+#! /bin/sh
+autoreconf -v --install || exit 1
+./configure --enable-maintainer-mode "$@"
diff --git a/configure.ac b/configure.ac
index c4c81b9..b4a4bd7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(mbinputmgr.c)
-AM_INIT_AUTOMAKE(mbinputmgr, 0.5)
+AM_INIT_AUTOMAKE(mbinputmgr, 0.6)
AM_CONFIG_HEADER(config.h)
MB_LIBS=""
@@ -34,7 +34,7 @@ if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists libmb; then
fi
AC_ARG_ENABLE(gnomeapplet,
- [ --enable-gnomeapplet Buld GNOME2 Applet.],
+ [ --enable-gnomeapplet Buld GNOME2 Applet (BROKEN).],
enable_gnomeapplet=$enableval, enable_gnomeapplet=no)
if test x$enable_gnomeapplet = xyes; then
diff --git a/mbinputmgr-tray.c b/mbinputmgr-tray.c
index 7a1651f..c0b91a0 100644
--- a/mbinputmgr-tray.c
+++ b/mbinputmgr-tray.c
@@ -32,6 +32,7 @@ int TrayAppLen = 0; /* len of tar app */
MBInpmgrState *Inpmgr_state = NULL;
Bool ButtonIsDown = False;
int ButtonActive;
+Atom AtomIMActivate;
typedef struct ButtonImgs {
@@ -59,6 +60,9 @@ paint_callback ( MBTrayApp *app, Drawable drw )
img_bg = mb_tray_app_get_background (app, Pixbuf);
+ if (img_bg == NULL)
+ return;
+
button = (ButtonImgs*)Inpmgr_state->MethodSelected->data;
if (ButtonIsDown)
@@ -81,6 +85,14 @@ paint_callback ( MBTrayApp *app, Drawable drw )
{
MBPixbufImage *img_tmp = NULL;
+ if (mb_pixbuf_img_get_width(img_bg) != TrayDepth
+ || mb_pixbuf_img_get_height(img_bg) != TrayAppLen)
+ {
+ mb_pixbuf_img_free(Pixbuf, img_bg);
+ return;
+ }
+
+
/* GREAT BIG FUCKING HACK -
app gets expose on orientation change
with mb_tray_app_tray_is_vertical = TRUE,
@@ -93,6 +105,7 @@ paint_callback ( MBTrayApp *app, Drawable drw )
*/
if (mb_pixbuf_img_get_width(img_bg) > mb_pixbuf_img_get_height(img_bg))
{
+ mb_pixbuf_img_render_to_drawable (Pixbuf, img_bg, drw, 0, 0);
mb_pixbuf_img_free(Pixbuf, img_bg);
return;
}
@@ -121,6 +134,15 @@ paint_callback ( MBTrayApp *app, Drawable drw )
else
{
+ if (mb_pixbuf_img_get_width(img_bg) != TrayAppLen
+ || mb_pixbuf_img_get_height(img_bg) != TrayDepth)
+ {
+ /* Dont paint till were sized how we want */
+ mb_pixbuf_img_render_to_drawable (Pixbuf, img_bg, drw, 0, 0);
+ mb_pixbuf_img_free(Pixbuf, img_bg);
+ return;
+ }
+
img_icon = mb_pixbuf_img_scale (Pixbuf,
img_selected,
IconWidth, TrayDepth );
@@ -233,6 +255,26 @@ button_callback (MBTrayApp *app, int x, int y, Bool is_released )
void
xevent_callback (MBTrayApp *app, XEvent *ev)
{
+ if (ev->type == ClientMessage)
+ {
+ printf("beep\n");
+
+ XClientMessageEvent *cmev = (XClientMessageEvent *)&ev->xconfigure;
+
+ if (cmev->message_type == AtomIMActivate)
+ {
+ printf("beep\n");
+
+ /* De Activate */
+ if (cmev->data.l[0] == 0 && mbinputmgr_method_active(Inpmgr_state))
+ mbinputmgr_toggle_selected_method (Inpmgr_state);
+ /* Activate */
+ else if (cmev->data.l[0] == 1
+ && !mbinputmgr_method_active(Inpmgr_state))
+ mbinputmgr_toggle_selected_method (Inpmgr_state);
+ }
+ }
+
mb_menu_handle_xevent (PopupMenu, ev);
}
@@ -315,6 +357,10 @@ main(int argc, char **argv)
Pixbuf = mb_pixbuf_new(mb_tray_app_xdisplay(app),
mb_tray_app_xscreen(app));
+ AtomIMActivate = XInternAtom(mb_tray_app_xdisplay(app),
+ "_MB_INPUT_REQUEST", False);
+
+
PopupMenu = mb_menu_new (mb_tray_app_xdisplay(app),
mb_tray_app_xscreen(app));
@@ -352,6 +398,11 @@ main(int argc, char **argv)
/* XXX set up dnotify to reload entrys only on _addition_ */
+ XSelectInput(mb_tray_app_xdisplay(app),
+ mb_tray_app_xrootwin(app),
+ SubstructureNotifyMask);
+
+
mb_tray_app_main (app);
return 0;