Skip to content

Commit

Permalink
add fltk gui skeleton, update makefile and add deps generation (also …
Browse files Browse the repository at this point in the history
…for qt4)
  • Loading branch information
ivop committed May 24, 2010
1 parent 21c1047 commit bbd1253
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 2 deletions.
31 changes: 29 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ OBJSqt4 = $(OBJScommon) \
guiqt4.o \
guiqt4-moc.o \

PRGfltk = fltkautoclick
OBJSfltk = $(OBJScommon) \
guifltk.o \

PRGcmdl = cautoclick
OBJScmdl = $(OBJScommon) \
guicommandline.o \
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -114,6 +126,9 @@ $(PRGqt3): $(OBJSqt3)
$(PRGqt4): $(OBJSqt4)
$(LD) -o $@ $(OBJSqt4) $(LDFLAGS)

$(PRGfltk): $(OBJSfltk)
$(LD) -o $@ $(OBJSfltk) $(LDFLAGS)

$(PRGcmdl): $(OBJScmdl)
$(LD) -o $@ $(OBJScmdl) $(LDFLAGS)

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
66 changes: 66 additions & 0 deletions guifltk.cpp
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>
}

#include <X11/Xlib.h>
#include <X11/extensions/XTest.h>

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) {
}

0 comments on commit bbd1253

Please sign in to comment.