Skip to content

Commit

Permalink
Merge branch 'xhandlers' of https://github.com/CendioOssman/tigervnc
Browse files Browse the repository at this point in the history
  • Loading branch information
CendioOssman committed Sep 15, 2014
2 parents 9e3dcea + 64ff1ca commit bf65abb
Show file tree
Hide file tree
Showing 33 changed files with 6,112 additions and 244 deletions.
56 changes: 6 additions & 50 deletions BUILDING.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,61 +84,17 @@ Build Requirements (Java)
Building FLTK
=============

TigerVNC requires FLTK 1.3.0 (or later). Although it will build and work
with plain 1.3.0, to get full functionality and the best behaviour you
TigerVNC requires FLTK 1.3.2 (or later). Although it will build and work
with plain 1.3.2, to get full functionality and the best behaviour you
need to build a patched version:

1. Check out FLTK 1.3.2 using Subversion:
$ svn co http://svn.easysw.com/public/fltk/fltk/tags/release-1.3.2 fltk-1.3.2

2. For full functionality, apply patches. Here's a shell script to do
that:

#!/bin/bash
set -e
apply_patch()
{
rm -f $2
wget http://www.fltk.org/strfiles/$1/$2
patch -p1 < $2
}

# Export dead key information from FLTK to the apps
# http://www.fltk.org/str.php?L2599
apply_patch 2599 fltk-1_v4.3.x-keyboard-x11.patch
apply_patch 2599 fltk-1_v4.3.x-keyboard-win32.patch
apply_patch 2599 fltk-1_v6.3.x-keyboard-osx.patch

# Notify applications of changes to the clipboard
# http://www.fltk.org/str.php?L2636
apply_patch 2636 fltk-1.3.x-clipboard.patch
apply_patch 2636 fltk-1_v6.3.x-clipboard-x11.patch
apply_patch 2636 fltk-1_v3.3.x-clipboard-win32-fix.patch
apply_patch 2636 fltk-1_v2.3.x-clipboard-win32.patch
apply_patch 2636 fltk-1_v2.3.x-clipboard-osx.patch

# Ability to convert a Fl_Pixmap to a Fl_RGB_Image
# http://www.fltk.org/str.php?L2659
apply_patch 2659 pixmap_v2.patch

# Support for custom cursors
# http://www.fltk.org/str.php?L2660
apply_patch 2660 fltk-1_v5.3.x-cursor.patch

# Improve modality interaction with WM
# http://www.fltk.org/str.php?L2802
apply_patch 2802 fltk-1_v2.3.0-modal.patch

# Window icons
# http://www.fltk.org/str.php?L2816
apply_patch 2816 fltk-1_v3.3.0-icons.patch

# Multihead
# http://fltk.org/str.php?L2860
apply_patch 2860 fltk-1.3.x-screen_num.patch
apply_patch 2860 fltk-1_v3.3.x-multihead.patch

### END SCRIPT ###
2. For full functionality, apply patches. All patches can be found in
the contrib/fltk/ directory. There are also some general fixes to
FLTK that can be found in the contrib/fltk/fixes/ directory that
might be useful.

3. Use CMake to build FLTK using the same procedures described below for
building TigerVNC. The recipes in the "Build Recipes" section also apply.
Expand Down
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ if(FLTK_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${FLTK_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${FLTK_LIBRARIES})

# FLTK STR #2599
check_cxx_source_compiles("#include <FL/Fl_Widget.H>\nint main(int c, char** v) { void (Fl_Widget::*foo)() = &Fl_Widget::set_simple_keyboard; return 0; }" HAVE_FLTK_DEAD_KEYS)

# FLTK STR #2636
check_cxx_source_compiles("#include <FL/Fl.H>\nint main(int c, char** v) { Fl::add_clipboard_notify(NULL, NULL); return 0; }" HAVE_FLTK_CLIPBOARD)

Expand All @@ -303,6 +300,12 @@ if(FLTK_FOUND)
# FLTK STR #2860
check_cxx_source_compiles("#include <FL/Fl_Window.H>\nint main(int c, char** v) { void (Fl_Window::*foo)(int,int,int,int) = &Fl_Window::fullscreen_screens; return 0; }" HAVE_FLTK_FULLSCREEN_SCREENS)

# FLTK STR #xxxx
check_cxx_source_compiles("#include <FL/Fl.H>\nint main(int c, char** v) { Fl::add_system_handler(NULL, NULL); return 0; }" HAVE_FLTK_XHANDLERS)

# FLTK STR #xxxx
check_cxx_source_compiles("#include <FL/Fl.H>\nint main(int c, char** v) { Fl::disable_im(); return 0; }" HAVE_FLTK_IM)

set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
endif()
Expand Down
2 changes: 1 addition & 1 deletion common/rdr/Exception.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Exception::Exception(const char *format, ...) {
}

SystemException::SystemException(const char* s, int err_)
: Exception(s), err(err_)
: Exception("%s", s), err(err_)
{
strncat(str_, ": ", len-1-strlen(str_));
#ifdef _WIN32
Expand Down
3 changes: 2 additions & 1 deletion config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
#cmakedefine HAVE_GNUTLS_DATUM_T
#cmakedefine HAVE_GNUTLS_PK_ALGORITHM_T
#cmakedefine HAVE_GNUTLS_SIGN_ALGORITHM_T
#cmakedefine HAVE_FLTK_DEAD_KEYS
#cmakedefine HAVE_FLTK_CLIPBOARD
#cmakedefine HAVE_FLTK_MEDIAKEYS
#cmakedefine HAVE_FLTK_FULLSCREEN
#cmakedefine HAVE_FLTK_FULLSCREEN_SCREENS
#cmakedefine HAVE_FLTK_CURSOR
#cmakedefine HAVE_FLTK_WORK_AREA
#cmakedefine HAVE_FLTK_ICONS
#cmakedefine HAVE_FLTK_XHANDLERS
#cmakedefine HAVE_FLTK_IM
#cmakedefine HAVE_ACTIVE_DESKTOP_H
#cmakedefine HAVE_ACTIVE_DESKTOP_L
#cmakedefine ENABLE_NLS 1
Expand Down
106 changes: 106 additions & 0 deletions contrib/fltk/01-str2636-fltk-1.3.x-clipboard.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
diff -up fltk-1.3.x-r8659/FL/Fl.H.orig fltk-1.3.x-r8659/FL/Fl.H
--- fltk-1.3.x-r8659/FL/Fl.H.orig 2011-05-17 16:25:56.671744548 +0200
+++ fltk-1.3.x-r8659/FL/Fl.H 2011-05-17 16:26:05.709101536 +0200
@@ -108,6 +108,9 @@ typedef int (*Fl_Args_Handler)(int argc,
\see Fl::event_dispatch(Fl_Event_Dispatch) */
typedef int (*Fl_Event_Dispatch)(int event, Fl_Window *w);

+/** Signature of add_clipboard_notify functions passed as parameters */
+typedef void (*Fl_Clipboard_Notify_Handler)(int source, void *data);
+
/** @} */ /* group callback_functions */


@@ -744,6 +747,19 @@ public:
*/
static void paste(Fl_Widget &receiver, int source /*=0*/); // platform dependent
/**
+ FLTK will call the registered callback whenever there is a change to the
+ selection buffer or the clipboard. The source argument indicates which
+ of the two has changed. Only changes by other applications are reported.
+ \note Some systems require polling to monitor the clipboard and may
+ therefore have some delay in detecting changes.
+ */
+ static void add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data);
+ /**
+ Stop calling the specified callback when there are changes to the selection
+ buffer or the clipboard.
+ */
+ static void remove_clipboard_notify(Fl_Clipboard_Notify_Handler h);
+ /**
Initiate a Drag And Drop operation. The selection buffer should be
filled with relevant data before calling this method. FLTK will
then initiate the system wide drag and drop handling. Dropped data
diff -up fltk-1.3.x-r8659/src/Fl.cxx.orig fltk-1.3.x-r8659/src/Fl.cxx
--- fltk-1.3.x-r8659/src/Fl.cxx.orig 2011-05-18 15:20:26.667291459 +0200
+++ fltk-1.3.x-r8659/src/Fl.cxx 2011-05-18 16:31:15.522026086 +0200
@@ -430,6 +430,69 @@ static char in_idle;
#endif

////////////////////////////////////////////////////////////////
+// Clipboard notifications
+
+struct Clipboard_Notify {
+ Fl_Clipboard_Notify_Handler handler;
+ void *data;
+ struct Clipboard_Notify *next;
+};
+
+static struct Clipboard_Notify *clip_notify_list = NULL;
+
+extern void fl_clipboard_notify_change(); // in Fl_<platform>.cxx
+
+void Fl::add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data) {
+ struct Clipboard_Notify *node;
+
+ remove_clipboard_notify(h);
+
+ node = new Clipboard_Notify;
+
+ node->handler = h;
+ node->data = data;
+ node->next = clip_notify_list;
+
+ clip_notify_list = node;
+
+ fl_clipboard_notify_change();
+}
+
+void Fl::remove_clipboard_notify(Fl_Clipboard_Notify_Handler h) {
+ struct Clipboard_Notify *node, **prev;
+
+ node = clip_notify_list;
+ prev = &clip_notify_list;
+ while (node != NULL) {
+ if (node->handler == h) {
+ *prev = node->next;
+ delete node;
+
+ fl_clipboard_notify_change();
+
+ return;
+ }
+
+ prev = &node->next;
+ node = node->next;
+ }
+}
+
+bool fl_clipboard_notify_empty(void) {
+ return clip_notify_list == NULL;
+}
+
+void fl_trigger_clipboard_notify(int source) {
+ struct Clipboard_Notify *node;
+
+ node = clip_notify_list;
+ while (node != NULL) {
+ node->handler(source, node->data);
+ node = node->next;
+ }
+}
+
+////////////////////////////////////////////////////////////////
// wait/run/check/ready:

void (*Fl::idle)(); // see Fl::add_idle.cxx for the add/remove functions
Loading

2 comments on commit bf65abb

@bphinz
Copy link
Member

@bphinz bphinz commented on bf65abb Sep 16, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch #12 does not apply cleanly (I can't look into why until later tonight):
...
patching file FL/Fl.H
patching file src/Fl_cocoa.mm
patching file src/Fl.cxx
patching file src/Fl_win32.cxx
Hunk #1 succeeded at 335 (offset -1 lines).
Hunk #2 FAILED at 403.
1 out of 2 hunks FAILED -- saving rejects to file src/Fl_win32.cxx.rej
...

@CendioOssman
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in c550e6f.

Please sign in to comment.