initial change to gtk2

SVN revision: 11022
master
Andreas Volz 18 years ago
parent 4040ca218f
commit 3d19d90015
  1. 22
      configure.in
  2. 6
      ipc.c
  3. 4
      viewer.c

@ -9,11 +9,23 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET
dnl Checks for libraries.
if !(gtk-config --version >/dev/null 2>&1); then
AC_MSG_ERROR([Gtk+ is required.])
else
CFLAGS="$CFLAGS `gtk-config --cflags`"
LIBS="$LIBS `gtk-config --libs`"
AC_ARG_ENABLE(gtk2,
[ --enable-gtk2=[no/yes] enables the gtk2 GUI (default=yes)],,
enable_gtk2=no)
if [ ! test "x$enable_gtk2" != "xyes"]; then
pkg_modules="gtk+-2.0 >= 2.0.0"
PKG_CHECK_MODULES(PACKAGE, [$pkg_modules])
CFLAGS="$CFLAGS $PACKAGE_CFLAGS"
LIBS="$LIBS $PACKAGE_LIBS"
AC_DEFINE(ENABLE_GTK2, , [Define to enable gtk2 support])
else
if !(gtk-config --version >/dev/null 2>&1); then
AC_MSG_ERROR([Gtk+ is required.])
else
CFLAGS="$CFLAGS `gtk-config --cflags`"
LIBS="$LIBS `gtk-config --libs`"
fi
fi
dnl Checks for header files.

@ -141,7 +141,11 @@ CommsFilter(GdkXEvent * gdk_xevent, GdkEvent * event, gpointer data)
if (!comms_win) {
GtkWidget *win, *label, *align, *frame, *button, *vbox;
#ifdef ENABLE_GTK2
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
#else
win = gtk_window_new(GTK_WINDOW_DIALOG);
#endif
gtk_window_set_policy(GTK_WINDOW(win), 0, 0, 1);
gtk_window_set_position(GTK_WINDOW(win), GTK_WIN_POS_CENTER);
frame = gtk_frame_new(NULL);
@ -166,7 +170,7 @@ CommsFilter(GdkXEvent * gdk_xevent, GdkEvent * event, gpointer data)
gtk_container_add(GTK_CONTAINER(align), vbox);
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
gtk_widget_show_all(win);
gtk_widget_show_all(win);
gtk_main();
exit(1);
}

@ -190,7 +190,11 @@ e_cb_key_change(GtkWidget * widget, gpointer data)
gdk_keyboard_grab(win->window, TRUE, CurrentTime);
XWindowEvent(GDK_DISPLAY(), GDK_WINDOW_XWINDOW(win->window),
KeyPressMask, &ev);
#ifdef ENABLE_GTK2
gdk_keyboard_ungrab(GDK_CURRENT_TIME);
#else
gdk_keyboard_ungrab(gdk_time_get());
#endif
key = XKeysymToString(XKeycodeToKeysym(GDK_DISPLAY(),
ev.xkey.keycode, 0));
gtk_entry_set_text(GTK_ENTRY(act_key),key);

Loading…
Cancel
Save