From bbd125331ed74ce37d25b244c2bd20f110a7c8ef Mon Sep 17 00:00:00 2001 From: Ivo van Poorten Date: Mon, 24 May 2010 12:03:14 +0000 Subject: [PATCH] add fltk gui skeleton, update makefile and add deps generation (also for qt4) --- Makefile | 31 +++++++++++++++++++++++-- guifltk.cpp | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 guifltk.cpp diff --git a/Makefile b/Makefile index 77e66d4..6150005 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,10 @@ OBJSqt4 = $(OBJScommon) \ guiqt4.o \ guiqt4-moc.o \ +PRGfltk = fltkautoclick +OBJSfltk = $(OBJScommon) \ + guifltk.o \ + PRGcmdl = cautoclick OBJScmdl = $(OBJScommon) \ guicommandline.o \ @@ -69,10 +73,15 @@ LDFLAGS += $(LDFLAGS_QT3) endif ifeq ($(__BUILD_QT4__),yes) -INCLUDES += $(INCLUDES_QT4) -g3 +INCLUDES += $(INCLUDES_QT4) LDFLAGS += $(LDFLAGS_QT4) endif +ifeq ($(__BUILD_FLTK__),yes) +INCLUDES += $(INCLUDES_FLTK) +LDFLAGS += $(LDFLAGS_FLTK) +endif + ifeq ($(__BUILD_COMMANDLINE__),yes) INCLUDES += $(INCLUDES_COMMANDLINE) LDFLAGS += $(LDFLAGS_COMMANDLINE) @@ -95,6 +104,9 @@ endif ifeq ($(HAVE_QT4),yes) __BUILD_QT4__=yes $(MAKE) -C . $(PRGqt4) endif +ifeq ($(HAVE_FLTK),yes) + __BUILD_FLTK__=yes $(MAKE) -C . $(PRGfltk) +endif ifeq ($(HAVE_COMMANDLINE),yes) __BUILD_COMMANDLINE__=yes $(MAKE) -C . $(PRGcmdl) endif @@ -114,6 +126,9 @@ $(PRGqt3): $(OBJSqt3) $(PRGqt4): $(OBJSqt4) $(LD) -o $@ $(OBJSqt4) $(LDFLAGS) +$(PRGfltk): $(OBJSfltk) + $(LD) -o $@ $(OBJSfltk) $(LDFLAGS) + $(PRGcmdl): $(OBJScmdl) $(LD) -o $@ $(OBJScmdl) $(LDFLAGS) @@ -153,6 +168,14 @@ ifneq ($(OBJSqt3),) -include $(patsubst %,.deps/%,$(OBJSqt3:.o=.d)) endif +ifneq ($(OBJSqt4),) +-include $(patsubst %,.deps/%,$(OBJSqt4:.o=.d)) +endif + +ifneq ($(OBJSfltk),) +-include $(patsubst %,.deps/%,$(OBJSfltk:.o=.d)) +endif + SILENCE = @ %.o: %.c @@ -168,7 +191,7 @@ SILENCE = @ .PHONY: clean clean: rm -f *.o $(PRGgtk1) $(PRGgtk2) $(PRGqt3) $(PRGascii) $(PRGcmdl) guigtk2.c - rm -f guiqt4-moc.cpp $(PRGqt4) + rm -f guiqt4-moc.cpp $(PRGqt4) $(PRGfltk) rm -rf .deps .PHONY: distclean @@ -193,6 +216,9 @@ endif ifeq ($(HAVE_QT4),yes) cp $(PRGqt4) $(PREFIX)/bin endif +ifeq ($(HAVE_FLTK),yes) + cp $(PRGfltk) $(PREFIX)/bin +endif ifeq ($(HAVE_ASCII),yes) cp $(PRGascii) $(PREFIX)/bin endif @@ -208,6 +234,7 @@ uninstall: rm -f $(PREFIX)/bin/$(PRGgtk2) rm -f $(PREFIX)/bin/$(PRGqt3) rm -f $(PREFIX)/bin/$(PRGqt4) + rm -f $(PREFIX)/bin/$(PRGfltk) rm -f $(PREFIX)/bin/$(PRGascii) rm -f $(PREFIX)/bin/$(PRGcmdl) rm -f $(PREFIX)/man/man1/xautoclick.1 diff --git a/guifltk.cpp b/guifltk.cpp new file mode 100644 index 0000000..6edf05a --- /dev/null +++ b/guifltk.cpp @@ -0,0 +1,66 @@ +/* xAutoClick, FLTK GUI + * + * Copyright (C) 2010 Ivo van Poorten + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +extern "C" { +#include "main.h" +#include "osdep.h" +#include +} + +#include +#include + +static Display *display; + +void click_mouse_button(void) { + XTestFakeButtonEvent(display, 1, True, CurrentTime); + XTestFakeButtonEvent(display, 1, False, CurrentTime); + XFlush(display); +} + +void set_alarm(int ms) { +} + +int get_spin_value(spin_t spin) { +// return mywidget->spins[spin]->value(); +} + +void set_spin_value(spin_t spin, int value) { +// mywidget->spins[spin]->setValue(value); +} + +void set_button_sensitive(button_t button, int state) { +// mywidget->buttons[button]->setEnabled(state); +} + +int init_gui(int argc, char **argv) { + if (!(display = XOpenDisplay(NULL))) { + fprintf(stderr, "Unable to open X display\n"); + return 0; + } + + return 1; +} + +void close_gui(void) { +} + +void main_loop(void) { +}