Removed GTK1 support and confusing "gtk_client_

git-svn-id: svn://svn.savannah.nongnu.org/lash/trunk@25 1de19dc7-4e3f-0410-a61d-eddf686bf0b7
This commit is contained in:
Dave Robillard 2006-03-24 20:52:28 +00:00
parent 4524a6a503
commit c619665b9e
5 changed files with 5 additions and 143 deletions

View File

@ -1 +1 @@
SUBDIRS = simple_client control gtk_client synth save_button panel
SUBDIRS = simple_client control synth save_button panel

View File

@ -1,39 +1,18 @@
include $(top_srcdir)/common.am
EXTRA_PROGRAMS = lash_save_button_2 lash_save_button
lash_save_button_2_SOURCES = \
save_button_2.0.c
lash_save_button_2_CFLAGS = \
$(LASH_CFLAGS) \
$(GTK2_CFLAGS)
lash_save_button_2_LDADD = \
$(top_builddir)/liblash/liblash.la \
$(GTK2_LIBS)
EXTRA_PROGRAMS = lash_save_button
lash_save_button_SOURCES = \
save_button.c \
hints.c hints.h
save_button.c
lash_save_button_CFLAGS = \
$(LASH_CFLAGS) \
$(GTK_CFLAGS)
$(GTK2_CFLAGS)
lash_save_button_LDADD = \
$(top_builddir)/liblash/liblash.la \
$(GTK_LIBS)
$(GTK2_LIBS)
if HAVE_GTK2
if HAVE_GTK
bin_PROGRAMS = lash_save_button_2 lash_save_button
else
bin_PROGRAMS = lash_save_button_2
endif
else
if HAVE_GTK
bin_PROGRAMS = lash_save_button
endif
endif

View File

@ -31,10 +31,6 @@
#include <stdlib.h>
#include <string.h>
#ifndef GTK2
# include "hints.h"
#endif
GtkWidget *window;
GtkWidget *button;
GtkWidget *menu;
@ -45,11 +41,7 @@ int position = 1;
lash_client_t *lash_client;
#ifdef GTK2
const char *client_class = "LASH Save Button 2";
#else
const char *client_class = "LASH Save Button";
#endif
void
quit_cb()
@ -57,46 +49,14 @@ quit_cb()
gtk_main_quit();
}
#ifndef GTK2
gboolean
motion_cb(GtkWidget * widget, GdkEventMotion * event, gpointer user_data)
{
int x, y;
gdk_window_get_position(gtk_widget_get_parent_window(button), &x, &y);
gdk_window_move(gtk_widget_get_parent_window(button), x + event->x,
y + event->y);
return TRUE;
}
gboolean
button_release_cb(GtkWidget * widget,
GdkEventButton * event, gpointer user_data)
{
gtk_signal_disconnect_by_func(GTK_OBJECT(button),
GTK_SIGNAL_FUNC(motion_cb), NULL);
gtk_grab_remove(button);
return FALSE;
}
#endif /* ndef GTK2 */
gboolean
button_press_cb(GtkWidget * widget,
GdkEventButton * event, gpointer user_data)
{
switch (event->button) {
case 2:
#ifdef GTK2
gtk_window_begin_move_drag(GTK_WINDOW(window), 2,
event->x_root, event->y_root, event->time);
#else
printf("middle button press\n");
gtk_signal_connect(GTK_OBJECT(button), "motion-notify-event",
GTK_SIGNAL_FUNC(motion_cb), NULL);
gtk_signal_connect(GTK_OBJECT(button), "button-release-event",
GTK_SIGNAL_FUNC(button_release_cb), NULL);
gtk_grab_add(button);
#endif
return TRUE;
case 3:
quit_cb();
@ -122,11 +82,7 @@ send_window_position()
int x, y;
char pos[16];
#ifdef GTK2
gtk_window_get_position(GTK_WINDOW(window), &x, &y);
#else
gdk_window_get_position(gtk_widget_get_parent_window(button), &x, &y);
#endif
sprintf(pos, "%d %d", x, y);
config = lash_config_new_with_key("window-position");
@ -166,19 +122,13 @@ idle_cb(void *data)
int x, y;
sscanf(lash_config_get_value_string(config), "%d %d", &x, &y);
#ifdef GTK2
gtk_window_move(GTK_WINDOW(window), x, y);
#else
gdk_window_move(gtk_widget_get_parent_window(button), x, y);
#endif
}
lash_config_destroy(config);
}
#ifdef GTK2
if (on_top)
gdk_window_raise(gtk_widget_get_parent_window(button));
#endif
usleep(10000);
@ -265,54 +215,25 @@ main(int argc, char **argv)
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), client_class);
gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE);
#ifdef GTK2
g_signal_connect(G_OBJECT(window), "delete_event",
G_CALLBACK(quit_cb), NULL);
if (on_top)
gtk_window_set_type_hint(GTK_WINDOW(window),
GDK_WINDOW_TYPE_HINT_MENU);
gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
#else
gtk_signal_connect(GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(quit_cb), NULL);
gtk_widget_realize(window);
gdk_window_set_decorations(window->window, 0);
#endif /* GTK2 */
button = gtk_button_new_with_label("Save");
/* GTK_WIDGET_UNSET_FLAGS ((button), (GTK_CAN_FOCUS)); */
gtk_widget_show(button);
gtk_container_add(GTK_CONTAINER(window), button);
#ifdef GTK2
g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(clicked_cb), NULL);
g_signal_connect(G_OBJECT(button), "button-press-event",
G_CALLBACK(button_press_cb), NULL);
#else
gtk_signal_connect(GTK_OBJECT(button), "clicked",
GTK_SIGNAL_FUNC(clicked_cb), NULL);
gtk_signal_connect(GTK_OBJECT(button), "button-press-event",
GTK_SIGNAL_FUNC(button_press_cb), NULL);
gtk_widget_add_events(button, GDK_POINTER_MOTION_MASK);
#endif /* GTK2 */
gtk_widget_show(window);
#ifdef GTK2
if (sticky)
gtk_window_stick(GTK_WINDOW(window));
#else
check_wm_hints();
if (sticky && hint_sticky_available())
set_sticky_func(window, TRUE);
if (on_top && hint_always_on_top_available()) {
set_always_func(window, TRUE);
if (hint_skip_winlist_available())
set_skip_winlist_func(window);
}
#endif
gtk_idle_add(idle_cb, NULL);

View File

@ -1,2 +0,0 @@
#define GTK2
#include "save_button.c"

View File

@ -131,34 +131,6 @@ fi
AM_CONDITIONAL(HAVE_READLINE, test "x$lash_readline" != "xno")
##############
### GTK+ 1 ###
##############
lash_gtk="yes"
AC_ARG_ENABLE(gtk,
[ --disable-gtk disable the gtk test client],[
case "$enableval" in
"yes")
;;
"no")
lash_gtk="no";
;;
*)
AC_MSG_ERROR([must use --enable-gtk(=yes/no) or --disable-gtk])
;;
esac
])
if test x$lash_gtk = xyes; then
AM_PATH_GTK(1.2.0, GTK_FOUND="yes", GTK_FOUND="no")
lash_gtk=$GTK_FOUND
fi
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
AM_CONDITIONAL(HAVE_GTK, test x$GTK_FOUND = xyes)
######################
### --enable-debug ###
######################
@ -259,7 +231,6 @@ AC_CONFIG_FILES([lashd/Makefile])
AC_CONFIG_FILES([clients/Makefile])
AC_CONFIG_FILES([clients/simple_client/Makefile])
AC_CONFIG_FILES([clients/control/Makefile])
AC_CONFIG_FILES([clients/gtk_client/Makefile])
AC_CONFIG_FILES([clients/synth/Makefile])
AC_CONFIG_FILES([clients/save_button/Makefile])
AC_CONFIG_FILES([clients/panel/Makefile])
@ -290,7 +261,6 @@ AC_MSG_RESULT([
readline support: $lash_readline
gtk 2 support: $lash_gtk2
gtk 1 support: $lash_gtk
debugging output: $lash_debug
building manual: $lash_texi2html
@ -301,9 +271,6 @@ AC_MSG_RESULT([
if test x$GTK2_FOUND = xyes; then
AC_MSG_RESULT([ GTK2_CFLAGS: $GTK2_CFLAGS ])
fi
if test x$GTK_FOUND = xyes; then
AC_MSG_RESULT([ GTK_CFLAGS: $GTK_CFLAGS ])
fi
AC_MSG_RESULT([ JACK_LIBS: $JACK_LIBS ])
AC_MSG_RESULT([ ALSA_LIBS: $ALSA_LIBS ])
@ -312,9 +279,6 @@ AC_MSG_RESULT([ XML2_LIBS: $XML2_LIBS ])
if test x$GTK2_FOUND = xyes; then
AC_MSG_RESULT([ GTK2_LIBS: $GTK2_LIBS ])
fi
if test x$GTK_FOUND = xyes; then
AC_MSG_RESULT([ GTK_LIBS: $GTK_LIBS ])
fi
if test x$lash_readline = xyes; then
AC_MSG_RESULT([ READLINE_LIBS: $READLINE_LIBS])
fi