mirror of
https://abf.rosa.ru/djam/fltk.git
synced 2025-02-23 17:02:52 +00:00
New version 1.3.3
Update patchset Disable cairo support (fails to build)
This commit is contained in:
parent
ac8c80eb10
commit
7cf0d752be
20 changed files with 221 additions and 4336 deletions
2
.abf.yml
2
.abf.yml
|
@ -1,2 +1,2 @@
|
|||
sources:
|
||||
fltk-1.3.2-source.tar.gz: 25071d6bb81cc136a449825bfd574094b48f07fb
|
||||
fltk-1.3.3-source.tar.gz: 873aac49b277149e054b9740378e2ca87b0bd435
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
diff -up fltk-1.3.0rc5/src/Makefile.undefined fltk-1.3.0rc5/src/Makefile
|
||||
--- fltk-1.3.0rc5/src/Makefile.undefined 2011-02-06 15:08:08.000000000 +0100
|
||||
+++ fltk-1.3.0rc5/src/Makefile 2011-05-25 16:19:41.430727963 +0200
|
||||
@@ -312,7 +312,7 @@ $(GLLIBNAME): $(GLOBJECTS)
|
||||
|
||||
libfltk_gl.so.1.3: $(GLOBJECTS) libfltk.so.1.3
|
||||
echo $(DSOCOMMAND) $@ ...
|
||||
- $(DSOCOMMAND) $@ $(GLOBJECTS) -L. -lfltk
|
||||
+ $(DSOCOMMAND) $@ $(GLOBJECTS) -L. $(GLDLIBS) -lfltk
|
||||
$(RM) libfltk_gl.so
|
||||
$(LN) libfltk_gl.so.1.3 libfltk_gl.so
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
diff -urN fltk-1.3.0/cairo/CMakeLists.txt fltk-1.3.0-patched/cairo/CMakeLists.txt
|
||||
--- fltk-1.3.0/cairo/CMakeLists.txt 2010-04-06 09:33:58.000000000 +1100
|
||||
+++ fltk-1.3.0-patched/cairo/CMakeLists.txt 2012-09-14 01:39:44.173275271 +1100
|
||||
@@ -8,7 +8,7 @@
|
||||
set(cairo_SRCS Fl_Cairo.cxx)
|
||||
|
||||
#######################################################################
|
||||
-add_library(fltk_cairo ${cairo_SRCS})
|
||||
+add_library(fltk_cairo STATIC ${cairo_SRCS})
|
||||
|
||||
if(MSVC)
|
||||
set_target_properties(fltk_cairo
|
||||
diff -urN fltk-1.3.0/fluid/CMakeLists.txt fltk-1.3.0-patched/fluid/CMakeLists.txt
|
||||
--- fltk-1.3.0/fluid/CMakeLists.txt 2011-01-06 20:24:58.000000000 +1000
|
||||
+++ fltk-1.3.0-patched/fluid/CMakeLists.txt 2012-09-14 01:40:08.347275014 +1100
|
||||
@@ -22,7 +22,7 @@
|
||||
)
|
||||
|
||||
add_executable(fluid ${CPPFILES})
|
||||
-target_link_libraries(fluid fltk fltk_images fltk_forms)
|
||||
+target_link_libraries(fluid fltk fltk_images fltk_forms dl)
|
||||
|
||||
# link in optional libraries
|
||||
if(FLTK_HAVE_CAIRO)
|
||||
diff -urN fltk-1.3.0/src/CMakeLists.txt fltk-1.3.0-patched/src/CMakeLists.txt
|
||||
--- fltk-1.3.0/src/CMakeLists.txt 2011-01-12 19:24:03.000000000 +1000
|
||||
+++ fltk-1.3.0-patched/src/CMakeLists.txt 2012-09-14 01:39:44.173275271 +1100
|
||||
@@ -333,6 +333,8 @@
|
||||
set_target_properties(fltk_SHARED PROPERTIES OUTPUT_NAME fltk)
|
||||
endif(MSVC)
|
||||
|
||||
+target_link_libraries(fltk_SHARED dl)
|
||||
+
|
||||
if(USE_THREADS)
|
||||
target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif(USE_THREADS)
|
||||
@@ -383,6 +385,8 @@
|
||||
set_target_properties(fltk_forms_SHARED PROPERTIES OUTPUT_NAME fltk_forms)
|
||||
endif(MSVC)
|
||||
|
||||
+target_link_libraries(fltk_forms_SHARED dl)
|
||||
+
|
||||
if(USE_THREADS)
|
||||
target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif(USE_THREADS)
|
||||
@@ -394,7 +398,7 @@
|
||||
#######################################################################
|
||||
add_library(fltk_images_SHARED SHARED ${IMGCPPFILES})
|
||||
target_link_libraries(fltk_images_SHARED fltk
|
||||
- ${FLTK_PNG_LIBRARIES} ${FLTK_JPEG_LIBRARIES} ${FLTK_ZLIB_LIBRARIES}
|
||||
+ ${FLTK_PNG_LIBRARIES} ${FLTK_JPEG_LIBRARIES} ${FLTK_ZLIB_LIBRARIES} dl
|
||||
)
|
||||
set_target_properties(fltk_images_SHARED
|
||||
PROPERTIES CLEAN_DIRECT_OUTPUT 1
|
||||
@@ -424,7 +428,7 @@
|
||||
#######################################################################
|
||||
if(OPENGL_FOUND)
|
||||
add_library(fltk_gl_SHARED SHARED ${GLCPPFILES})
|
||||
- target_link_libraries(fltk_gl_SHARED fltk ${OPENGL_LIBRARIES})
|
||||
+ target_link_libraries(fltk_gl_SHARED fltk ${OPENGL_LIBRARIES} dl)
|
||||
set_target_properties(fltk_gl_SHARED
|
||||
PROPERTIES CLEAN_DIRECT_OUTPUT 1
|
||||
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
|
14
fltk-1.3.3-cmake35.patch
Normal file
14
fltk-1.3.3-cmake35.patch
Normal file
|
@ -0,0 +1,14 @@
|
|||
diff -urN fltk-1.3.3-orig/CMakeLists.txt fltk-1.3.3-patched/CMakeLists.txt
|
||||
--- fltk-1.3.3-orig/CMakeLists.txt 2014-10-10 03:03:56.000000000 +1100
|
||||
+++ fltk-1.3.3-patched/CMakeLists.txt 2016-08-26 16:25:43.256631466 +1000
|
||||
@@ -24,6 +24,10 @@
|
||||
project(FLTK)
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
+if(POLICY CMP0053)
|
||||
+ cmake_policy(SET CMP0053 NEW)
|
||||
+endif()
|
||||
+
|
||||
#######################################################################
|
||||
# define some macros
|
||||
#######################################################################
|
44
fltk-1.3.3-do-not-use-internal-ABI.patch
Normal file
44
fltk-1.3.3-do-not-use-internal-ABI.patch
Normal file
|
@ -0,0 +1,44 @@
|
|||
Index: FL/x.H
|
||||
===================================================================
|
||||
--- a/FL/x.H (revision 10476)
|
||||
+++ b/FL/x.H (working copy)
|
||||
@@ -132,6 +132,7 @@
|
||||
XFontStruct *ptr;
|
||||
};
|
||||
extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
|
||||
+extern FL_EXPORT XFontStruct* fl_core_font();
|
||||
|
||||
// this object contains all X-specific stuff about a window:
|
||||
// Warning: this object is highly subject to change!
|
||||
Index: src/fl_font.cxx
|
||||
===================================================================
|
||||
--- a/src/fl_font.cxx (revision 10476)
|
||||
+++ b/src/fl_font.cxx (working copy)
|
||||
@@ -55,6 +55,14 @@
|
||||
# include "fl_font_x.cxx"
|
||||
#endif // WIN32
|
||||
|
||||
+#ifdef WIN32
|
||||
+#elif defined(__APPLE__)
|
||||
+#else
|
||||
+XFontStruct *fl_core_font()
|
||||
+{
|
||||
+ return fl_xfont.value();
|
||||
+}
|
||||
+#endif
|
||||
|
||||
double fl_width(const char* c) {
|
||||
if (c) return fl_width(c, (int) strlen(c));
|
||||
Index: src/gl_draw.cxx
|
||||
===================================================================
|
||||
--- a/src/gl_draw.cxx (revision 10476)
|
||||
+++ b/src/gl_draw.cxx (working copy)
|
||||
@@ -84,7 +84,7 @@
|
||||
* then sorting through them at draw time (for normal X rendering) to find which one can
|
||||
* render the current glyph... But for now, just use the first font in the list for GL...
|
||||
*/
|
||||
- XFontStruct *font = fl_xfont;
|
||||
+ XFontStruct *font = fl_core_font();
|
||||
int base = font->min_char_or_byte2;
|
||||
int count = font->max_char_or_byte2-base+1;
|
||||
fl_fontsize->listbase = glGenLists(256);
|
33
fltk-1.3.3-install-fltk-config.patch
Normal file
33
fltk-1.3.3-install-fltk-config.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
--- fltk-1.3.3/CMake/install.cmake~ 2015-08-15 15:36:28.947402327 +0800
|
||||
+++ fltk-1.3.3/CMake/install.cmake 2015-08-15 16:02:41.641006985 +0800
|
||||
@@ -70,6 +70,15 @@
|
||||
DESTINATION ${FLTK_CONFIG_PATH}
|
||||
)
|
||||
|
||||
+configure_file(
|
||||
+ ${FLTK_SOURCE_DIR}/fltk-config.cmake.in
|
||||
+ ${FLTK_BINARY_DIR}/fltk-config
|
||||
+ @ONLY
|
||||
+)
|
||||
+install(PROGRAMS ${FLTK_BINARY_DIR}/fltk-config
|
||||
+ DESTINATION bin
|
||||
+)
|
||||
+
|
||||
if(UNIX)
|
||||
macro(INSTALL_MAN FILE LEVEL)
|
||||
install(FILES
|
||||
--- fltk-1.3.3/fltk-config.cmake.in~ 2013-04-07 00:15:17.000000000 +0800
|
||||
+++ fltk-1.3.3/fltk-config.cmake.in 2015-08-15 16:07:14.808585610 +0800
|
||||
@@ -31,9 +31,9 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
exec_prefix_set=no
|
||||
-bindir=@PREFIX_BIN@
|
||||
-includedir=@PREFIX_INCLUDE@
|
||||
-libdir=@PREFIX_LIB@
|
||||
+bindir=${prefix}/bin
|
||||
+includedir=%{prefix}/include
|
||||
+libdir=@CMAKE_INSTALL_LIBDIR@
|
||||
srcdir=.
|
||||
|
||||
# compiler names
|
24
fltk-1.3.3-lib-prefix.patch
Normal file
24
fltk-1.3.3-lib-prefix.patch
Normal file
|
@ -0,0 +1,24 @@
|
|||
--- fltk-1.3.3/CMake/macros.cmake~ 2014-10-12 09:24:04.000000000 +0800
|
||||
+++ fltk-1.3.3/CMake/macros.cmake 2015-08-14 17:15:20.103729445 +0800
|
||||
@@ -66,8 +66,8 @@
|
||||
install(TARGETS ${LIBRARY_NAME}
|
||||
EXPORT FLTK-Targets
|
||||
RUNTIME DESTINATION bin
|
||||
- LIBRARY DESTINATION lib
|
||||
- ARCHIVE DESTINATION lib
|
||||
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
list(APPEND FLTK_LIBRARIES "${LIBRARY_NAME}")
|
||||
--- fltk-1.3.3/CMake/setup.cmake~ 2014-10-05 08:03:27.000000000 +0800
|
||||
+++ fltk-1.3.3/CMake/setup.cmake 2015-08-14 17:16:01.644922420 +0800
|
||||
@@ -58,7 +58,7 @@
|
||||
set(FLTK_CONFIG_PATH FLTK/.framework/Resources/CMake)
|
||||
set(FLTK_EXAMPLES_PATH share/fltk-examples)
|
||||
else()
|
||||
- set(FLTK_CONFIG_PATH lib/fltk)
|
||||
+ set(FLTK_CONFIG_PATH ${CMAKE_INSTALL_LIBDIR}/fltk)
|
||||
set(FLTK_EXAMPLES_PATH share/fltk-examples)
|
||||
endif(WIN32 AND NOT CYGWIN)
|
||||
|
73
fltk-1.3.3-link.patch
Normal file
73
fltk-1.3.3-link.patch
Normal file
|
@ -0,0 +1,73 @@
|
|||
--- fltk-1.3.3/CMake/options.cmake~ 2014-09-27 08:41:06.000000000 +0800
|
||||
+++ fltk-1.3.3/CMake/options.cmake 2015-08-14 16:13:01.246131531 +0800
|
||||
@@ -45,7 +45,7 @@
|
||||
endif(APPLE)
|
||||
|
||||
if((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)
|
||||
- include(FindX11)
|
||||
+ find_package(X11)
|
||||
if(X11_FOUND)
|
||||
set(USE_X11 1)
|
||||
list(APPEND FLTK_CFLAGS -DUSE_X11)
|
||||
--- fltk-1.3.3/src/CMakeLists.txt.0000 2014-10-31 00:05:22.000000000 +0800
|
||||
+++ fltk-1.3.3/src/CMakeLists.txt 2015-08-20 15:33:25.997586144 +0800
|
||||
@@ -218,7 +218,7 @@
|
||||
endif(USE_THREADS)
|
||||
|
||||
if(USE_X11)
|
||||
- target_link_libraries(fltk ${X11_LIBRARIES})
|
||||
+ target_link_libraries(fltk ${X11_Xext_LIB} ${X11_X11_LIB} ${LIB_dl})
|
||||
endif(USE_X11)
|
||||
|
||||
if(WIN32)
|
||||
@@ -278,7 +278,7 @@
|
||||
#######################################################################
|
||||
if(OPENGL_FOUND)
|
||||
FL_ADD_LIBRARY(fltk_gl STATIC "${GLCPPFILES}")
|
||||
- target_link_libraries(fltk_gl fltk ${OPENGL_LIBRARIES})
|
||||
+ target_link_libraries(fltk_gl fltk ${OPENGL_gl_LIBRARY})
|
||||
endif(OPENGL_FOUND)
|
||||
|
||||
#######################################################################
|
||||
@@ -293,7 +293,7 @@
|
||||
endif(USE_THREADS)
|
||||
|
||||
if(USE_X11)
|
||||
- target_link_libraries(fltk_SHARED ${X11_LIBRARIES})
|
||||
+ target_link_libraries(fltk_SHARED ${X11_Xext_LIB} ${X11_X11_LIB} ${LIB_dl})
|
||||
endif(USE_X11)
|
||||
|
||||
if(WIN32)
|
||||
@@ -308,6 +308,14 @@
|
||||
target_link_libraries(fltk_SHARED ${X11_Xinerama_LIB})
|
||||
endif(HAVE_XINERAMA)
|
||||
|
||||
+if(HAVE_XFIXES)
|
||||
+ target_link_libraries(fltk_SHARED ${X11_Xfixes_LIB})
|
||||
+endif(HAVE_XFIXES)
|
||||
+
|
||||
+if(HAVE_XCURSOR)
|
||||
+ target_link_libraries(fltk_SHARED ${X11_Xcursor_LIB})
|
||||
+endif(HAVE_XCURSOR)
|
||||
+
|
||||
if(USE_XFT)
|
||||
target_link_libraries(fltk_SHARED ${X11_Xft_LIB})
|
||||
if(LIB_fontconfig)
|
||||
@@ -324,7 +332,7 @@
|
||||
endif(USE_THREADS)
|
||||
|
||||
if(USE_X11)
|
||||
- target_link_libraries(fltk_forms_SHARED ${X11_LIBRARIES})
|
||||
+ target_link_libraries(fltk_forms_SHARED ${X11_X11_LIB})
|
||||
endif(USE_X11)
|
||||
|
||||
#######################################################################
|
||||
@@ -352,7 +360,7 @@
|
||||
#######################################################################
|
||||
if(OPENGL_FOUND)
|
||||
FL_ADD_LIBRARY(fltk_gl SHARED "${GLCPPFILES}")
|
||||
- target_link_libraries(fltk_gl_SHARED fltk_SHARED ${OPENGL_LIBRARIES})
|
||||
+ target_link_libraries(fltk_gl_SHARED fltk_SHARED ${OPENGL_gl_LIBRARY})
|
||||
endif(OPENGL_FOUND)
|
||||
|
||||
#######################################################################
|
11
fltk-1.3.3-man-install-dir.patch
Normal file
11
fltk-1.3.3-man-install-dir.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- fltk-1.3.3/CMake/install.cmake~ 2014-09-27 08:41:06.000000000 +0800
|
||||
+++ fltk-1.3.3/CMake/install.cmake 2015-08-14 16:59:34.606534063 +0800
|
||||
@@ -74,7 +74,7 @@
|
||||
macro(INSTALL_MAN FILE LEVEL)
|
||||
install(FILES
|
||||
${FLTK_SOURCE_DIR}/documentation/src/${FILE}.man
|
||||
- DESTINATION man/man${LEVEL}
|
||||
+ DESTINATION share/man/man${LEVEL}
|
||||
RENAME ${FILE}.${LEVEL}
|
||||
)
|
||||
endmacro(INSTALL_MAN FILE LEVEL)
|
|
@ -1,106 +0,0 @@
|
|||
diff -up fltk-1.3.x-r9671/FL/Fl.H.clipboard fltk-1.3.x-r9671/FL/Fl.H
|
||||
--- fltk-1.3.x-r9671/FL/Fl.H.clipboard 2012-04-10 16:18:35.000000000 -0500
|
||||
+++ fltk-1.3.x-r9671/FL/Fl.H 2013-08-21 15:33:43.727827500 -0500
|
||||
@@ -109,6 +109,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 */
|
||||
|
||||
|
||||
@@ -746,6 +749,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-r9671/src/Fl.cxx.clipboard fltk-1.3.x-r9671/src/Fl.cxx
|
||||
--- fltk-1.3.x-r9671/src/Fl.cxx.clipboard 2013-08-21 15:33:43.721827561 -0500
|
||||
+++ fltk-1.3.x-r9671/src/Fl.cxx 2013-08-21 15:33:43.728827490 -0500
|
||||
@@ -437,6 +437,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
|
File diff suppressed because it is too large
Load diff
|
@ -1,75 +0,0 @@
|
|||
diff -up fltk-1.3.x-r9671/src/Fl_cocoa.mm.modal fltk-1.3.x-r9671/src/Fl_cocoa.mm
|
||||
--- fltk-1.3.x-r9671/src/Fl_cocoa.mm.modal 2013-08-21 15:37:44.719365974 -0500
|
||||
+++ fltk-1.3.x-r9671/src/Fl_cocoa.mm 2013-08-21 15:37:44.741365748 -0500
|
||||
@@ -661,12 +661,9 @@ void Fl::remove_timeout(Fl_Timeout_Handl
|
||||
return NO; // prevent the caption to be redrawn as active on click
|
||||
// when another modal window is currently the key win
|
||||
|
||||
- return !(w->tooltip_window() || w->menu_window());
|
||||
+ return !w->tooltip_window();
|
||||
}
|
||||
|
||||
-// TODO see if we really need a canBecomeMainWindow ...
|
||||
-#if 0
|
||||
-
|
||||
- (BOOL)canBecomeMainWindow
|
||||
{
|
||||
if (Fl::modal_ && (Fl::modal_ != w))
|
||||
@@ -675,7 +672,6 @@ void Fl::remove_timeout(Fl_Timeout_Handl
|
||||
|
||||
return !(w->tooltip_window() || w->menu_window());
|
||||
}
|
||||
-#endif
|
||||
|
||||
@end
|
||||
|
||||
diff -up fltk-1.3.x-r9671/src/Fl_win32.cxx.modal fltk-1.3.x-r9671/src/Fl_win32.cxx
|
||||
--- fltk-1.3.x-r9671/src/Fl_win32.cxx.modal 2013-08-21 15:37:44.721365954 -0500
|
||||
+++ fltk-1.3.x-r9671/src/Fl_win32.cxx 2013-08-21 15:37:44.742365738 -0500
|
||||
@@ -942,6 +942,10 @@ static LRESULT CALLBACK WndProc(HWND hWn
|
||||
break;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
+ if ((Fl::modal_) && (Fl::modal_ != window)) {
|
||||
+ SetFocus(fl_xid(Fl::modal_));
|
||||
+ return 0;
|
||||
+ }
|
||||
Fl::handle(FL_FOCUS, window);
|
||||
break;
|
||||
|
||||
@@ -1668,6 +1672,11 @@ Fl_X* Fl_X::make(Fl_Window* w) {
|
||||
Fl::e_number = old_event;
|
||||
w->redraw(); // force draw to happen
|
||||
}
|
||||
+
|
||||
+ // Needs to be done before ShowWindow() to get the correct behaviour
|
||||
+ // when we get WM_SETFOCUS.
|
||||
+ if (w->modal()) {Fl::modal_ = w; fl_fix_focus();}
|
||||
+
|
||||
// If we've captured the mouse, we dont want to activate any
|
||||
// other windows from the code, or we lose the capture.
|
||||
ShowWindow(x->xid, !showit ? SW_SHOWMINNOACTIVE :
|
||||
@@ -1685,7 +1694,6 @@ Fl_X* Fl_X::make(Fl_Window* w) {
|
||||
}
|
||||
}
|
||||
|
||||
- if (w->modal()) {Fl::modal_ = w; fl_fix_focus();}
|
||||
return x;
|
||||
}
|
||||
|
||||
diff -up fltk-1.3.x-r9671/src/Fl_x.cxx.modal fltk-1.3.x-r9671/src/Fl_x.cxx
|
||||
--- fltk-1.3.x-r9671/src/Fl_x.cxx.modal 2013-08-21 15:37:44.732365841 -0500
|
||||
+++ fltk-1.3.x-r9671/src/Fl_x.cxx 2013-08-21 15:37:44.742365738 -0500
|
||||
@@ -2100,6 +2100,12 @@ void Fl_X::make_xid(Fl_Window* win, XVis
|
||||
while (wp->parent()) wp = wp->window();
|
||||
XSetTransientForHint(fl_display, xp->xid, fl_xid(wp));
|
||||
if (!wp->visible()) showit = 0; // guess that wm will not show it
|
||||
+ if (win->modal()) {
|
||||
+ Atom net_wm_state = XInternAtom (fl_display, "_NET_WM_STATE", 0);
|
||||
+ Atom net_wm_state_skip_taskbar = XInternAtom (fl_display, "_NET_WM_STATE_MODAL", 0);
|
||||
+ XChangeProperty (fl_display, xp->xid, net_wm_state, XA_ATOM, 32,
|
||||
+ PropModeAppend, (unsigned char*) &net_wm_state_skip_taskbar, 1);
|
||||
+ }
|
||||
}
|
||||
|
||||
// Make sure that borderless windows do not show in the task bar
|
|
@ -1,131 +0,0 @@
|
|||
diff -up fltk-1.3.0r9619/FL/Fl.H.screen_num fltk-1.3.0r9619/FL/Fl.H
|
||||
--- fltk-1.3.0r9619/FL/Fl.H.screen_num 2012-07-03 13:49:28.663085580 +0200
|
||||
+++ fltk-1.3.0r9619/FL/Fl.H 2012-07-03 13:49:28.731084402 +0200
|
||||
@@ -806,6 +806,8 @@ public:
|
||||
static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my);
|
||||
static void screen_xywh(int &X, int &Y, int &W, int &H, int n);
|
||||
static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh);
|
||||
+ static int screen_num(int x, int y);
|
||||
+ static int screen_num(int x, int y, int w, int h);
|
||||
static void screen_dpi(float &h, float &v, int n=0);
|
||||
static void screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my);
|
||||
static void screen_work_area(int &X, int &Y, int &W, int &H, int n);
|
||||
diff -up fltk-1.3.0r9619/src/screen_xywh.cxx.screen_num fltk-1.3.0r9619/src/screen_xywh.cxx
|
||||
--- fltk-1.3.0r9619/src/screen_xywh.cxx.screen_num 2012-03-23 17:47:53.000000000 +0100
|
||||
+++ fltk-1.3.0r9619/src/screen_xywh.cxx 2012-07-03 13:58:01.947195396 +0200
|
||||
@@ -215,21 +215,6 @@ int Fl::screen_count() {
|
||||
return num_screens ? num_screens : 1;
|
||||
}
|
||||
|
||||
-static int find_screen_with_point(int mx, int my) {
|
||||
- int screen = 0;
|
||||
- if (num_screens < 0) screen_init();
|
||||
-
|
||||
- for (int i = 0; i < num_screens; i ++) {
|
||||
- int sx, sy, sw, sh;
|
||||
- Fl::screen_xywh(sx, sy, sw, sh, i);
|
||||
- if ((mx >= sx) && (mx < (sx+sw)) && (my >= sy) && (my < (sy+sh))) {
|
||||
- screen = i;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- return screen;
|
||||
-}
|
||||
-
|
||||
/**
|
||||
Gets the bounding box of a screen
|
||||
that contains the specified screen position \p mx, \p my
|
||||
@@ -237,7 +222,7 @@ static int find_screen_with_point(int mx
|
||||
\param[in] mx, my the absolute screen position
|
||||
*/
|
||||
void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my) {
|
||||
- screen_xywh(X, Y, W, H, find_screen_with_point(mx, my));
|
||||
+ screen_xywh(X, Y, W, H, screen_num(mx, my));
|
||||
}
|
||||
|
||||
|
||||
@@ -248,7 +233,7 @@ void Fl::screen_xywh(int &X, int &Y, int
|
||||
\param[in] mx, my the absolute screen position
|
||||
*/
|
||||
void Fl::screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my) {
|
||||
- screen_work_area(X, Y, W, H, find_screen_with_point(mx, my));
|
||||
+ screen_work_area(X, Y, W, H, screen_num(mx, my));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,6 +306,38 @@ void Fl::screen_xywh(int &X, int &Y, int
|
||||
#endif // WIN32
|
||||
}
|
||||
|
||||
+/**
|
||||
+ Gets the screen bounding rect for the screen
|
||||
+ which intersects the most with the rectangle
|
||||
+ defined by \p mx, \p my, \p mw, \p mh.
|
||||
+ \param[out] X,Y,W,H the corresponding screen bounding box
|
||||
+ \param[in] mx, my, mw, mh the rectangle to search for intersection with
|
||||
+ \see void screen_xywh(int &X, int &Y, int &W, int &H, int n)
|
||||
+ */
|
||||
+void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh) {
|
||||
+ screen_xywh(X, Y, W, H, screen_num(mx, my, mw, mh));
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ Gets the screen number of a screen
|
||||
+ that contains the specified screen position \p x, \p y
|
||||
+ \param[in] x, y the absolute screen position
|
||||
+*/
|
||||
+int Fl::screen_num(int x, int y) {
|
||||
+ int screen = 0;
|
||||
+ if (num_screens < 0) screen_init();
|
||||
+
|
||||
+ for (int i = 0; i < num_screens; i ++) {
|
||||
+ int sx, sy, sw, sh;
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, i);
|
||||
+ if ((x >= sx) && (x < (sx+sw)) && (y >= sy) && (y < (sy+sh))) {
|
||||
+ screen = i;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ return screen;
|
||||
+}
|
||||
+
|
||||
static inline float fl_intersection(int x1, int y1, int w1, int h1,
|
||||
int x2, int y2, int w2, int h2) {
|
||||
if(x1+w1 < x2 || x2+w2 < x1 || y1+h1 < y2 || y2+h2 < y1)
|
||||
@@ -333,30 +350,27 @@ static inline float fl_intersection(int
|
||||
}
|
||||
|
||||
/**
|
||||
- Gets the screen bounding rect for the screen
|
||||
+ Gets the screen number for the screen
|
||||
which intersects the most with the rectangle
|
||||
- defined by \p mx, \p my, \p mw, \p mh.
|
||||
- \param[out] X,Y,W,H the corresponding screen bounding box
|
||||
- \param[in] mx, my, mw, mh the rectangle to search for intersection with
|
||||
- \see void screen_xywh(int &X, int &Y, int &W, int &H, int n)
|
||||
+ defined by \p x, \p y, \p w, \p h.
|
||||
+ \param[in] x, y, w, h the rectangle to search for intersection with
|
||||
*/
|
||||
-void Fl::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh) {
|
||||
+int Fl::screen_num(int x, int y, int w, int h) {
|
||||
int best_screen = 0;
|
||||
float best_intersection = 0.;
|
||||
for(int i = 0; i < Fl::screen_count(); i++) {
|
||||
int sx, sy, sw, sh;
|
||||
Fl::screen_xywh(sx, sy, sw, sh, i);
|
||||
- float sintersection = fl_intersection(mx, my, mw, mh, sx, sy, sw, sh);
|
||||
+ float sintersection = fl_intersection(x, y, w, h, sx, sy, sw, sh);
|
||||
if(sintersection > best_intersection) {
|
||||
best_screen = i;
|
||||
best_intersection = sintersection;
|
||||
}
|
||||
}
|
||||
- screen_xywh(X, Y, W, H, best_screen);
|
||||
+ return best_screen;
|
||||
}
|
||||
|
||||
|
||||
-
|
||||
/**
|
||||
Gets the screen resolution in dots-per-inch for the given screen.
|
||||
\param[out] h, v horizontal and vertical resolution
|
|
@ -1,645 +0,0 @@
|
|||
diff -ur fltk-1.3.2.org/FL/Fl_Window.H fltk-1.3.2/FL/Fl_Window.H
|
||||
--- fltk-1.3.2.org/FL/Fl_Window.H 2013-01-16 10:49:40.904228200 +0100
|
||||
+++ fltk-1.3.2/FL/Fl_Window.H 2013-01-16 10:49:55.554353925 +0100
|
||||
@@ -22,6 +22,10 @@
|
||||
#ifndef Fl_Window_H
|
||||
#define Fl_Window_H
|
||||
|
||||
+#ifdef WIN32
|
||||
+#include <windows.h>
|
||||
+#endif
|
||||
+
|
||||
#include "Fl_Group.H"
|
||||
|
||||
#define FL_WINDOW 0xF0 ///< window type id all subclasses have type() >= this
|
||||
@@ -73,9 +77,19 @@
|
||||
friend class Fl_X;
|
||||
Fl_X *i; // points at the system-specific stuff
|
||||
|
||||
+ struct icon_data {
|
||||
+ const void *legacy_icon;
|
||||
+ Fl_RGB_Image **icons;
|
||||
+ int count;
|
||||
+#ifdef WIN32
|
||||
+ HICON big_icon;
|
||||
+ HICON small_icon;
|
||||
+#endif
|
||||
+ };
|
||||
+
|
||||
const char* iconlabel_;
|
||||
char* xclass_;
|
||||
- const void* icon_;
|
||||
+ struct icon_data *icon_;
|
||||
// size_range stuff:
|
||||
int minw, minh, maxw, maxh;
|
||||
int dw, dh, aspect;
|
||||
@@ -121,6 +135,8 @@
|
||||
*/
|
||||
int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
|
||||
|
||||
+ void free_icons();
|
||||
+
|
||||
public:
|
||||
|
||||
/**
|
||||
@@ -350,6 +366,18 @@
|
||||
static const char *default_xclass();
|
||||
const char* xclass() const;
|
||||
void xclass(const char* c);
|
||||
+
|
||||
+ static void default_icon(const Fl_RGB_Image*);
|
||||
+ static void default_icons(const Fl_RGB_Image*[], int);
|
||||
+ void icon(const Fl_RGB_Image*);
|
||||
+ void icons(const Fl_RGB_Image*[], int);
|
||||
+
|
||||
+#ifdef WIN32
|
||||
+ static void default_icons(HICON big_icon, HICON small_icon);
|
||||
+ void icons(HICON big_icon, HICON small_icon);
|
||||
+#endif
|
||||
+
|
||||
+ /* for legacy compatibility */
|
||||
const void* icon() const;
|
||||
void icon(const void * ic);
|
||||
|
||||
diff -ur fltk-1.3.2.org/FL/mac.H fltk-1.3.2/FL/mac.H
|
||||
--- fltk-1.3.2.org/FL/mac.H 2013-01-16 10:49:40.904228200 +0100
|
||||
+++ fltk-1.3.2/FL/mac.H 2013-01-16 10:49:55.554353925 +0100
|
||||
@@ -120,6 +120,9 @@
|
||||
void collapse(void);
|
||||
WindowRef window_ref(void);
|
||||
void set_key_window(void);
|
||||
+ // OS X doesn't have per window icons
|
||||
+ static void set_default_icons(const Fl_RGB_Image*[], int) {};
|
||||
+ void set_icons() {};
|
||||
int set_cursor(Fl_Cursor);
|
||||
int set_cursor(const Fl_RGB_Image*, int, int);
|
||||
static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h);
|
||||
diff -ur fltk-1.3.2.org/FL/win32.H fltk-1.3.2/FL/win32.H
|
||||
--- fltk-1.3.2.org/FL/win32.H 2013-01-16 10:49:40.904228200 +0100
|
||||
+++ fltk-1.3.2/FL/win32.H 2013-01-16 10:49:55.555355617 +0100
|
||||
@@ -84,6 +84,9 @@
|
||||
void flush() {w->flush();}
|
||||
void set_minmax(LPMINMAXINFO minmax);
|
||||
void mapraise();
|
||||
+ static void set_default_icons(const Fl_RGB_Image*[], int);
|
||||
+ static void set_default_icons(HICON, HICON);
|
||||
+ void set_icons();
|
||||
int set_cursor(Fl_Cursor);
|
||||
int set_cursor(const Fl_RGB_Image*, int, int);
|
||||
static Fl_X* make(Fl_Window*);
|
||||
diff -ur fltk-1.3.2.org/FL/x.H fltk-1.3.2/FL/x.H
|
||||
--- fltk-1.3.2.org/FL/x.H 2013-01-16 10:49:40.904228200 +0100
|
||||
+++ fltk-1.3.2/FL/x.H 2013-01-16 10:49:55.555355617 +0100
|
||||
@@ -154,6 +154,8 @@
|
||||
static Fl_X* i(const Fl_Window* wi) {return wi->i;}
|
||||
void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
|
||||
void sendxjunk();
|
||||
+ static void set_default_icons(const Fl_RGB_Image*[], int);
|
||||
+ void set_icons();
|
||||
int set_cursor(Fl_Cursor);
|
||||
int set_cursor(const Fl_RGB_Image*, int, int);
|
||||
static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);
|
||||
diff -ur fltk-1.3.2.org/src/Fl.cxx fltk-1.3.2/src/Fl.cxx
|
||||
--- fltk-1.3.2.org/src/Fl.cxx 2013-01-16 10:49:40.895228113 +0100
|
||||
+++ fltk-1.3.2/src/Fl.cxx 2013-01-16 10:49:55.556137979 +0100
|
||||
@@ -1530,6 +1530,8 @@
|
||||
if (xclass_) {
|
||||
free(xclass_);
|
||||
}
|
||||
+ free_icons();
|
||||
+ delete icon_;
|
||||
}
|
||||
|
||||
// FL_SHOW and FL_HIDE are called whenever the visibility of this widget
|
||||
diff -ur fltk-1.3.2.org/src/Fl_win32.cxx fltk-1.3.2/src/Fl_win32.cxx
|
||||
--- fltk-1.3.2.org/src/Fl_win32.cxx 2013-01-16 10:49:40.911227539 +0100
|
||||
+++ fltk-1.3.2/src/Fl_win32.cxx 2013-01-16 10:49:55.556137979 +0100
|
||||
@@ -1804,6 +1804,8 @@
|
||||
);
|
||||
if (lab) free(lab);
|
||||
|
||||
+ x->set_icons();
|
||||
+
|
||||
if (w->fullscreen_active()) {
|
||||
/* We need to make sure that the fullscreen is created on the
|
||||
default monitor, ie the desktop where the shortcut is located
|
||||
@@ -2034,71 +2036,19 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
-#ifndef IDC_HAND
|
||||
-# define IDC_HAND MAKEINTRESOURCE(32649)
|
||||
-#endif // !IDC_HAND
|
||||
-
|
||||
-int Fl_X::set_cursor(Fl_Cursor c) {
|
||||
- LPSTR n;
|
||||
- HCURSOR new_cursor;
|
||||
-
|
||||
- if (c == FL_CURSOR_NONE)
|
||||
- new_cursor = NULL;
|
||||
- else {
|
||||
- switch (c) {
|
||||
- case FL_CURSOR_ARROW: n = IDC_ARROW; break;
|
||||
- case FL_CURSOR_CROSS: n = IDC_CROSS; break;
|
||||
- case FL_CURSOR_WAIT: n = IDC_WAIT; break;
|
||||
- case FL_CURSOR_INSERT: n = IDC_IBEAM; break;
|
||||
- case FL_CURSOR_HAND: n = IDC_HAND; break;
|
||||
- case FL_CURSOR_HELP: n = IDC_HELP; break;
|
||||
- case FL_CURSOR_MOVE: n = IDC_SIZEALL; break;
|
||||
- case FL_CURSOR_N:
|
||||
- case FL_CURSOR_S:
|
||||
- // FIXME: Should probably have fallbacks for these instead
|
||||
- case FL_CURSOR_NS: n = IDC_SIZENS; break;
|
||||
- case FL_CURSOR_NE:
|
||||
- case FL_CURSOR_SW:
|
||||
- // FIXME: Dito.
|
||||
- case FL_CURSOR_NESW: n = IDC_SIZENESW; break;
|
||||
- case FL_CURSOR_E:
|
||||
- case FL_CURSOR_W:
|
||||
- // FIXME: Dito.
|
||||
- case FL_CURSOR_WE: n = IDC_SIZEWE; break;
|
||||
- case FL_CURSOR_SE:
|
||||
- case FL_CURSOR_NW:
|
||||
- // FIXME: Dito.
|
||||
- case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break;
|
||||
- default:
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- new_cursor = LoadCursor(NULL, n);
|
||||
- if (new_cursor == NULL)
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- if ((cursor != NULL) && custom_cursor)
|
||||
- DestroyIcon(cursor);
|
||||
-
|
||||
- cursor = new_cursor;
|
||||
- custom_cursor = 0;
|
||||
-
|
||||
- SetCursor(cursor);
|
||||
-
|
||||
- return 1;
|
||||
-}
|
||||
-
|
||||
-int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) {
|
||||
+static HICON image_to_icon(const Fl_RGB_Image *image, bool is_icon=true,
|
||||
+ int hotx = 0, int hoty = 0) {
|
||||
BITMAPV5HEADER bi;
|
||||
HBITMAP bitmap, mask;
|
||||
DWORD *bits;
|
||||
- HCURSOR new_cursor;
|
||||
+ HICON icon;
|
||||
|
||||
+ if (!is_icon) {
|
||||
if ((hotx < 0) || (hotx >= image->w()))
|
||||
- return 0;
|
||||
+ return NULL;
|
||||
if ((hoty < 0) || (hoty >= image->h()))
|
||||
- return 0;
|
||||
+ return NULL;
|
||||
+ }
|
||||
|
||||
memset(&bi, 0, sizeof(BITMAPV5HEADER));
|
||||
|
||||
@@ -2120,7 +2070,7 @@
|
||||
ReleaseDC(NULL, hdc);
|
||||
|
||||
if (bits == NULL)
|
||||
- return 0;
|
||||
+ return NULL;
|
||||
|
||||
const uchar *i = (const uchar*)*image->data();
|
||||
for (int y = 0;y < image->h();y++) {
|
||||
@@ -2149,22 +2099,206 @@
|
||||
mask = CreateBitmap(image->w(),image->h(),1,1,NULL);
|
||||
if (mask == NULL) {
|
||||
DeleteObject(bitmap);
|
||||
- return 0;
|
||||
+ return NULL;
|
||||
}
|
||||
|
||||
ICONINFO ii;
|
||||
|
||||
- ii.fIcon = FALSE;
|
||||
+ ii.fIcon = is_icon;
|
||||
ii.xHotspot = hotx;
|
||||
ii.yHotspot = hoty;
|
||||
ii.hbmMask = mask;
|
||||
ii.hbmColor = bitmap;
|
||||
|
||||
- new_cursor = CreateIconIndirect(&ii);
|
||||
+ icon = CreateIconIndirect(&ii);
|
||||
|
||||
DeleteObject(bitmap);
|
||||
DeleteObject(mask);
|
||||
|
||||
+ if (icon == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
+ return icon;
|
||||
+}
|
||||
+
|
||||
+////////////////////////////////////////////////////////////////
|
||||
+
|
||||
+static HICON default_big_icon = NULL;
|
||||
+static HICON default_small_icon = NULL;
|
||||
+
|
||||
+const Fl_RGB_Image *find_best_icon(int ideal_width,
|
||||
+ const Fl_RGB_Image *icons[], int count) {
|
||||
+ const Fl_RGB_Image *best;
|
||||
+
|
||||
+ best = NULL;
|
||||
+
|
||||
+ for (int i = 0;i < count;i++) {
|
||||
+ if (best == NULL)
|
||||
+ best = icons[i];
|
||||
+ else {
|
||||
+ if (best->w() < ideal_width) {
|
||||
+ if (icons[i]->w() > best->w())
|
||||
+ best = icons[i];
|
||||
+ } else {
|
||||
+ if ((icons[i]->w() >= ideal_width) &&
|
||||
+ (icons[i]->w() < best->w()))
|
||||
+ best = icons[i];
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return best;
|
||||
+}
|
||||
+
|
||||
+void Fl_X::set_default_icons(const Fl_RGB_Image *icons[], int count) {
|
||||
+ const Fl_RGB_Image *best_big, *best_small;
|
||||
+
|
||||
+ if (default_big_icon != NULL)
|
||||
+ DestroyIcon(default_big_icon);
|
||||
+ if (default_small_icon != NULL)
|
||||
+ DestroyIcon(default_small_icon);
|
||||
+
|
||||
+ best_big = find_best_icon(GetSystemMetrics(SM_CXICON), icons, count);
|
||||
+ best_small = find_best_icon(GetSystemMetrics(SM_CXSMICON), icons, count);
|
||||
+
|
||||
+ if (best_big != NULL)
|
||||
+ default_big_icon = image_to_icon(best_big);
|
||||
+ else
|
||||
+ default_big_icon = NULL;
|
||||
+
|
||||
+ if (best_small != NULL)
|
||||
+ default_small_icon = image_to_icon(best_small);
|
||||
+ else
|
||||
+ default_small_icon = NULL;
|
||||
+}
|
||||
+
|
||||
+void Fl_X::set_default_icons(HICON big_icon, HICON small_icon) {
|
||||
+ if (default_big_icon != NULL)
|
||||
+ DestroyIcon(default_big_icon);
|
||||
+ if (default_small_icon != NULL)
|
||||
+ DestroyIcon(default_small_icon);
|
||||
+
|
||||
+ if (big_icon != NULL)
|
||||
+ default_big_icon = CopyIcon(big_icon);
|
||||
+ if (small_icon != NULL)
|
||||
+ default_small_icon = CopyIcon(small_icon);
|
||||
+}
|
||||
+
|
||||
+void Fl_X::set_icons() {
|
||||
+ HICON big_icon, small_icon;
|
||||
+
|
||||
+ big_icon = NULL;
|
||||
+ small_icon = NULL;
|
||||
+
|
||||
+ if (w->icon_->count) {
|
||||
+ const Fl_RGB_Image *best_big, *best_small;
|
||||
+
|
||||
+ best_big = find_best_icon(GetSystemMetrics(SM_CXICON),
|
||||
+ (const Fl_RGB_Image **)w->icon_->icons,
|
||||
+ w->icon_->count);
|
||||
+ best_small = find_best_icon(GetSystemMetrics(SM_CXSMICON),
|
||||
+ (const Fl_RGB_Image **)w->icon_->icons,
|
||||
+ w->icon_->count);
|
||||
+
|
||||
+ if (best_big != NULL)
|
||||
+ big_icon = image_to_icon(best_big);
|
||||
+ if (best_small != NULL)
|
||||
+ small_icon = image_to_icon(best_small);
|
||||
+ } else {
|
||||
+ big_icon = default_big_icon;
|
||||
+ small_icon = default_small_icon;
|
||||
+ }
|
||||
+
|
||||
+ if (big_icon != NULL)
|
||||
+ SendMessage(xid, WM_SETICON, ICON_BIG, (LPARAM)big_icon);
|
||||
+ if (small_icon != NULL)
|
||||
+ SendMessage(xid, WM_SETICON, ICON_SMALL, (LPARAM)small_icon);
|
||||
+
|
||||
+ if (w->icon_->count) {
|
||||
+ if (big_icon != NULL)
|
||||
+ DestroyIcon(big_icon);
|
||||
+ if (small_icon != NULL)
|
||||
+ DestroyIcon(small_icon);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void Fl_Window::default_icons(HICON big_icon, HICON small_icon) {
|
||||
+ Fl_X::set_default_icons(big_icon, small_icon);
|
||||
+}
|
||||
+
|
||||
+void Fl_Window::icons(HICON big_icon, HICON small_icon) {
|
||||
+ free_icons();
|
||||
+
|
||||
+ if (big_icon != NULL)
|
||||
+ icon_->big_icon = CopyIcon(big_icon);
|
||||
+ if (small_icon != NULL)
|
||||
+ icon_->small_icon = CopyIcon(small_icon);
|
||||
+
|
||||
+ if (i)
|
||||
+ i->set_icons();
|
||||
+}
|
||||
+
|
||||
+////////////////////////////////////////////////////////////////
|
||||
+
|
||||
+#ifndef IDC_HAND
|
||||
+# define IDC_HAND MAKEINTRESOURCE(32649)
|
||||
+#endif // !IDC_HAND
|
||||
+
|
||||
+int Fl_X::set_cursor(Fl_Cursor c) {
|
||||
+ LPSTR n;
|
||||
+ HCURSOR new_cursor;
|
||||
+
|
||||
+ if (c == FL_CURSOR_NONE)
|
||||
+ new_cursor = NULL;
|
||||
+ else {
|
||||
+ switch (c) {
|
||||
+ case FL_CURSOR_ARROW: n = IDC_ARROW; break;
|
||||
+ case FL_CURSOR_CROSS: n = IDC_CROSS; break;
|
||||
+ case FL_CURSOR_WAIT: n = IDC_WAIT; break;
|
||||
+ case FL_CURSOR_INSERT: n = IDC_IBEAM; break;
|
||||
+ case FL_CURSOR_HAND: n = IDC_HAND; break;
|
||||
+ case FL_CURSOR_HELP: n = IDC_HELP; break;
|
||||
+ case FL_CURSOR_MOVE: n = IDC_SIZEALL; break;
|
||||
+ case FL_CURSOR_N:
|
||||
+ case FL_CURSOR_S:
|
||||
+ // FIXME: Should probably have fallbacks for these instead
|
||||
+ case FL_CURSOR_NS: n = IDC_SIZENS; break;
|
||||
+ case FL_CURSOR_NE:
|
||||
+ case FL_CURSOR_SW:
|
||||
+ // FIXME: Dito.
|
||||
+ case FL_CURSOR_NESW: n = IDC_SIZENESW; break;
|
||||
+ case FL_CURSOR_E:
|
||||
+ case FL_CURSOR_W:
|
||||
+ // FIXME: Dito.
|
||||
+ case FL_CURSOR_WE: n = IDC_SIZEWE; break;
|
||||
+ case FL_CURSOR_SE:
|
||||
+ case FL_CURSOR_NW:
|
||||
+ // FIXME: Dito.
|
||||
+ case FL_CURSOR_NWSE: n = IDC_SIZENWSE; break;
|
||||
+ default:
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ new_cursor = LoadCursor(NULL, n);
|
||||
+ if (new_cursor == NULL)
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if ((cursor != NULL) && custom_cursor)
|
||||
+ DestroyIcon(cursor);
|
||||
+
|
||||
+ cursor = new_cursor;
|
||||
+ custom_cursor = 0;
|
||||
+
|
||||
+ SetCursor(cursor);
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) {
|
||||
+ HCURSOR new_cursor;
|
||||
+
|
||||
+ new_cursor = image_to_icon(image, false, hotx, hoty);
|
||||
if (new_cursor == NULL)
|
||||
return 0;
|
||||
|
||||
diff -ur fltk-1.3.2.org/src/Fl_Window.cxx fltk-1.3.2/src/Fl_Window.cxx
|
||||
--- fltk-1.3.2.org/src/Fl_Window.cxx 2013-01-16 10:49:40.908130903 +0100
|
||||
+++ fltk-1.3.2/src/Fl_Window.cxx 2013-01-16 10:49:55.557353865 +0100
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <config.h>
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/x.H>
|
||||
+#include <FL/Fl_RGB_Image.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
#include <stdlib.h>
|
||||
#include "flstring.h"
|
||||
@@ -45,7 +46,8 @@
|
||||
}
|
||||
i = 0;
|
||||
xclass_ = 0;
|
||||
- icon_ = 0;
|
||||
+ icon_ = new icon_data;
|
||||
+ memset(icon_, 0, sizeof(*icon_));
|
||||
iconlabel_ = 0;
|
||||
resizable(0);
|
||||
size_range_set = 0;
|
||||
@@ -264,16 +266,68 @@
|
||||
}
|
||||
}
|
||||
|
||||
+void Fl_Window::default_icon(const Fl_RGB_Image *icon) {
|
||||
+ default_icons(&icon, 1);
|
||||
+}
|
||||
+
|
||||
+void Fl_Window::default_icons(const Fl_RGB_Image **icons, int count) {
|
||||
+ Fl_X::set_default_icons(icons, count);
|
||||
+}
|
||||
+
|
||||
+void Fl_Window::icon(const Fl_RGB_Image *icon) {
|
||||
+ icons(&icon, 1);
|
||||
+}
|
||||
+
|
||||
+void Fl_Window::icons(const Fl_RGB_Image **icons, int count) {
|
||||
+ free_icons();
|
||||
+
|
||||
+ if (count > 0) {
|
||||
+ icon_->icons = new Fl_RGB_Image*[count];
|
||||
+ icon_->count = count;
|
||||
+ // FIXME: Fl_RGB_Image lacks const modifiers on methods
|
||||
+ for (int i = 0;i < count;i++)
|
||||
+ icon_->icons[i] = (Fl_RGB_Image*)((Fl_RGB_Image*)icons[i])->copy();
|
||||
+ }
|
||||
+
|
||||
+ if (i)
|
||||
+ i->set_icons();
|
||||
+}
|
||||
+
|
||||
/** Gets the current icon window target dependent data. */
|
||||
const void *Fl_Window::icon() const {
|
||||
- return icon_;
|
||||
+ return icon_->legacy_icon;
|
||||
}
|
||||
|
||||
/** Sets the current icon window target dependent data. */
|
||||
void Fl_Window::icon(const void * ic) {
|
||||
- icon_ = ic;
|
||||
+ free_icons();
|
||||
+ icon_->legacy_icon = ic;
|
||||
}
|
||||
|
||||
+void Fl_Window::free_icons() {
|
||||
+ int i;
|
||||
+
|
||||
+ icon_->legacy_icon = 0L;
|
||||
+
|
||||
+ if (icon_->icons) {
|
||||
+ for (i = 0;i < icon_->count;i++)
|
||||
+ delete icon_->icons[i];
|
||||
+ delete [] icon_->icons;
|
||||
+ icon_->icons = 0L;
|
||||
+ }
|
||||
+
|
||||
+ icon_->count = 0;
|
||||
+
|
||||
+#ifdef WIN32
|
||||
+ if (icon_->big_icon)
|
||||
+ DestroyIcon(icon_->big_icon);
|
||||
+ if (icon_->small_icon)
|
||||
+ DestroyIcon(icon_->small_icon);
|
||||
+
|
||||
+ icon_->big_icon = NULL;
|
||||
+ icon_->small_icon = NULL;
|
||||
+#endif
|
||||
+}
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Window.cxx 9706 2012-11-06 20:46:14Z matt $".
|
||||
diff -ur fltk-1.3.2.org/src/Fl_x.cxx fltk-1.3.2/src/Fl_x.cxx
|
||||
--- fltk-1.3.2.org/src/Fl_x.cxx 2013-01-16 10:49:40.912227213 +0100
|
||||
+++ fltk-1.3.2/src/Fl_x.cxx 2013-01-16 10:49:55.558137113 +0100
|
||||
@@ -345,6 +345,7 @@
|
||||
Atom fl_NET_WM_STATE;
|
||||
Atom fl_NET_WM_STATE_FULLSCREEN;
|
||||
Atom fl_NET_WORKAREA;
|
||||
+Atom fl_NET_WM_ICON;
|
||||
|
||||
/*
|
||||
X defines 32-bit-entities to have a format value of max. 32,
|
||||
@@ -709,6 +710,7 @@
|
||||
fl_NET_WM_STATE = XInternAtom(d, "_NET_WM_STATE", 0);
|
||||
fl_NET_WM_STATE_FULLSCREEN = XInternAtom(d, "_NET_WM_STATE_FULLSCREEN", 0);
|
||||
fl_NET_WORKAREA = XInternAtom(d, "_NET_WORKAREA", 0);
|
||||
+ fl_NET_WM_ICON = XInternAtom(d, "_NET_WM_ICON", 0);
|
||||
|
||||
if (sizeof(Atom) < 4)
|
||||
atom_bits = sizeof(Atom) * 8;
|
||||
@@ -2138,12 +2140,14 @@
|
||||
fl_show_iconic = 0;
|
||||
showit = 0;
|
||||
}
|
||||
- if (win->icon()) {
|
||||
- hints->icon_pixmap = (Pixmap)win->icon();
|
||||
+ if (win->icon_->legacy_icon) {
|
||||
+ hints->icon_pixmap = (Pixmap)win->icon_->legacy_icon;
|
||||
hints->flags |= IconPixmapHint;
|
||||
}
|
||||
XSetWMHints(fl_display, xp->xid, hints);
|
||||
XFree(hints);
|
||||
+
|
||||
+ xp->set_icons();
|
||||
}
|
||||
|
||||
// set the window type for menu and tooltip windows to avoid animations (compiz)
|
||||
@@ -2263,6 +2267,93 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
+static unsigned long *default_net_wm_icons = 0L;
|
||||
+static size_t default_net_wm_icons_size = 0;
|
||||
+
|
||||
+void icons_to_property(const Fl_RGB_Image *icons[], int count,
|
||||
+ unsigned long **property, size_t *len) {
|
||||
+ size_t sz;
|
||||
+ unsigned long *data;
|
||||
+
|
||||
+ sz = 0;
|
||||
+ for (int i = 0;i < count;i++)
|
||||
+ sz += 2 + icons[i]->w() * icons[i]->h();
|
||||
+
|
||||
+ // FIXME: Might want to sort the icons
|
||||
+
|
||||
+ *property = data = new unsigned long[sz];
|
||||
+ *len = sz;
|
||||
+
|
||||
+ for (int i = 0;i < count;i++) {
|
||||
+ const Fl_RGB_Image *image;
|
||||
+
|
||||
+ image = icons[i];
|
||||
+
|
||||
+ data[0] = image->w();
|
||||
+ data[1] = image->h();
|
||||
+ data += 2;
|
||||
+
|
||||
+ const uchar *in = (const uchar*)*image->data();
|
||||
+ for (int y = 0;y < image->h();y++) {
|
||||
+ for (int x = 0;x < image->w();x++) {
|
||||
+ switch (image->d()) {
|
||||
+ case 1:
|
||||
+ *data = ( 0xff<<24) | (in[0]<<16) | (in[0]<<8) | in[0];
|
||||
+ break;
|
||||
+ case 2:
|
||||
+ *data = (in[1]<<24) | (in[0]<<16) | (in[0]<<8) | in[0];
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ *data = ( 0xff<<24) | (in[0]<<16) | (in[1]<<8) | in[2];
|
||||
+ break;
|
||||
+ case 4:
|
||||
+ *data = (in[3]<<24) | (in[0]<<16) | (in[1]<<8) | in[2];
|
||||
+ break;
|
||||
+ }
|
||||
+ in += image->d();
|
||||
+ data++;
|
||||
+ }
|
||||
+ in += image->ld();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void Fl_X::set_default_icons(const Fl_RGB_Image *icons[], int count) {
|
||||
+ if (default_net_wm_icons) {
|
||||
+ delete [] default_net_wm_icons;
|
||||
+ default_net_wm_icons = 0L;
|
||||
+ default_net_wm_icons_size = 0;
|
||||
+ }
|
||||
+
|
||||
+ if (count > 0)
|
||||
+ icons_to_property(icons, count,
|
||||
+ &default_net_wm_icons, &default_net_wm_icons_size);
|
||||
+}
|
||||
+
|
||||
+void Fl_X::set_icons() {
|
||||
+ unsigned long *net_wm_icons;
|
||||
+ size_t net_wm_icons_size;
|
||||
+
|
||||
+ if (w->icon_->count) {
|
||||
+ icons_to_property((const Fl_RGB_Image **)w->icon_->icons, w->icon_->count,
|
||||
+ &net_wm_icons, &net_wm_icons_size);
|
||||
+ } else {
|
||||
+ net_wm_icons = default_net_wm_icons;
|
||||
+ net_wm_icons_size = default_net_wm_icons_size;
|
||||
+ }
|
||||
+
|
||||
+ XChangeProperty (fl_display, xid, fl_NET_WM_ICON, XA_CARDINAL, 32,
|
||||
+ PropModeReplace, (unsigned char*) net_wm_icons, net_wm_icons_size);
|
||||
+
|
||||
+ if (w->icon_->count) {
|
||||
+ delete [] net_wm_icons;
|
||||
+ net_wm_icons = 0L;
|
||||
+ net_wm_icons_size = 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+////////////////////////////////////////////////////////////////
|
||||
+
|
||||
int Fl_X::set_cursor(Fl_Cursor c) {
|
||||
unsigned int shape;
|
||||
Cursor xc;
|
|
@ -1,468 +0,0 @@
|
|||
diff -urp fltk-1.3.2.org/FL/Fl_Window.H fltk-1.3.2/FL/Fl_Window.H
|
||||
--- fltk-1.3.2.org/FL/Fl_Window.H 2013-01-16 10:52:33.017228122 +0100
|
||||
+++ fltk-1.3.2/FL/Fl_Window.H 2013-01-16 10:52:47.876478968 +0100
|
||||
@@ -54,7 +54,7 @@ class Fl_RGB_Image;
|
||||
class FL_EXPORT Fl_Window : public Fl_Group {
|
||||
|
||||
static char *default_xclass_;
|
||||
- // Note: we must use separate statements for each of the following 4 variables,
|
||||
+ // Note: we must use separate statements for each of the following 8 variables,
|
||||
// with the static attribute, otherwise MS VC++ 2008/2010 complains :-(
|
||||
// AlbrechtS 04/2012
|
||||
#if FLTK_ABI_VERSION < 10301
|
||||
@@ -73,6 +73,22 @@ class FL_EXPORT Fl_Window : public Fl_Gr
|
||||
static // when these members are static, ABI compatibility with 1.3.0 is respected
|
||||
#endif
|
||||
int no_fullscreen_h;
|
||||
+#if FLTK_ABI_VERSION < 10302
|
||||
+ static // when these members are static, ABI compatibility with 1.3.0 is respected
|
||||
+#endif
|
||||
+ int fullscreen_screen_top;
|
||||
+#if FLTK_ABI_VERSION < 10302
|
||||
+ static // when these members are static, ABI compatibility with 1.3.0 is respected
|
||||
+#endif
|
||||
+ int fullscreen_screen_bottom;
|
||||
+#if FLTK_ABI_VERSION < 10302
|
||||
+ static // when these members are static, ABI compatibility with 1.3.0 is respected
|
||||
+#endif
|
||||
+ int fullscreen_screen_left;
|
||||
+#if FLTK_ABI_VERSION < 10302
|
||||
+ static // when these members are static, ABI compatibility with 1.3.0 is respected
|
||||
+#endif
|
||||
+ int fullscreen_screen_right;
|
||||
|
||||
friend class Fl_X;
|
||||
Fl_X *i; // points at the system-specific stuff
|
||||
@@ -430,13 +446,15 @@ public:
|
||||
*/
|
||||
void show(int argc, char **argv);
|
||||
/**
|
||||
- Makes the window completely fill the screen, without any window
|
||||
- manager border visible. You must use fullscreen_off() to undo
|
||||
- this.
|
||||
+ Makes the window completely fill one or more screens, without any
|
||||
+ window manager border visible. You must use fullscreen_off() to
|
||||
+ undo this.
|
||||
|
||||
\note On some platforms, this can result in the keyboard being
|
||||
grabbed. The window may also be recreated, meaning hide() and
|
||||
show() will be called.
|
||||
+
|
||||
+ \see void Fl_Window::fullscreen_screens()
|
||||
*/
|
||||
void fullscreen();
|
||||
/**
|
||||
@@ -453,6 +471,17 @@ public:
|
||||
*/
|
||||
unsigned int fullscreen_active() const { return flags() & FULLSCREEN; }
|
||||
/**
|
||||
+ Sets which screens should be used when this window is in fullscreen
|
||||
+ mode. The window will be resized to the top of the screen with index
|
||||
+ \p top, the bottom of the screen with index \p bottom, etc.
|
||||
+
|
||||
+ If this method is never called, or if any argument is < 0, then the
|
||||
+ window will be resized to fill the screen it is currently on.
|
||||
+
|
||||
+ \see void Fl_Window::fullscreen()
|
||||
+ */
|
||||
+ void fullscreen_screens(int top, int bottom, int left, int right);
|
||||
+ /**
|
||||
Iconifies the window. If you call this when shown() is false
|
||||
it will show() it as an icon. If the window is already
|
||||
iconified this does nothing.
|
||||
diff -urp fltk-1.3.2.org/FL/win32.H fltk-1.3.2/FL/win32.H
|
||||
--- fltk-1.3.2.org/FL/win32.H 2013-01-16 10:52:33.017228122 +0100
|
||||
+++ fltk-1.3.2/FL/win32.H 2013-01-16 10:52:47.876478968 +0100
|
||||
@@ -80,6 +80,7 @@ public:
|
||||
static Fl_X* i(const Fl_Window* w) {return w->i;}
|
||||
static int fake_X_wm(const Fl_Window* w,int &X, int &Y,
|
||||
int &bt,int &bx,int &by);
|
||||
+ void make_fullscreen(int X, int Y, int W, int H);
|
||||
void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
|
||||
void flush() {w->flush();}
|
||||
void set_minmax(LPMINMAXINFO minmax);
|
||||
diff -urp fltk-1.3.2.org/src/Fl_cocoa.mm fltk-1.3.2/src/Fl_cocoa.mm
|
||||
--- fltk-1.3.2.org/src/Fl_cocoa.mm 2013-01-16 10:52:33.014229574 +0100
|
||||
+++ fltk-1.3.2/src/Fl_cocoa.mm 2013-01-16 10:52:47.877480606 +0100
|
||||
@@ -2438,9 +2438,32 @@ void Fl_X::make(Fl_Window* w)
|
||||
|
||||
NSRect crect;
|
||||
if (w->fullscreen_active()) {
|
||||
- int sx, sy, sw, sh;
|
||||
- Fl::screen_xywh(sx, sy, sw, sh, w->x(), w->y(), w->w(), w->h());
|
||||
- w->resize(sx, sy, sw, sh);
|
||||
+ int top, bottom, left, right;
|
||||
+ int sx, sy, sw, sh, X, Y, W, H;
|
||||
+
|
||||
+ top = w->fullscreen_screen_top;
|
||||
+ bottom = w->fullscreen_screen_bottom;
|
||||
+ left = w->fullscreen_screen_left;
|
||||
+ right = w->fullscreen_screen_right;
|
||||
+
|
||||
+ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) {
|
||||
+ top = Fl::screen_num(w->x(), w->y(), w->w(), w->h());
|
||||
+ bottom = top;
|
||||
+ left = top;
|
||||
+ right = top;
|
||||
+ }
|
||||
+
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, top);
|
||||
+ Y = sy;
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, bottom);
|
||||
+ H = sy + sh - Y;
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, left);
|
||||
+ X = sx;
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, right);
|
||||
+ W = sx + sw - X;
|
||||
+
|
||||
+ w->resize(X, Y, W, H);
|
||||
+
|
||||
winstyle = NSBorderlessWindowMask;
|
||||
winlevel = NSStatusWindowLevel;
|
||||
}
|
||||
diff -urp fltk-1.3.2.org/src/Fl_win32.cxx fltk-1.3.2/src/Fl_win32.cxx
|
||||
--- fltk-1.3.2.org/src/Fl_win32.cxx 2013-01-16 10:52:33.019230734 +0100
|
||||
+++ fltk-1.3.2/src/Fl_win32.cxx 2013-01-16 10:52:47.878480504 +0100
|
||||
@@ -1493,7 +1493,6 @@ int Fl_X::fake_X_wm(const Fl_Window* w,i
|
||||
Y+=yoff;
|
||||
|
||||
if (w->fullscreen_active()) {
|
||||
- X = Y = 0;
|
||||
bx = by = bt = 0;
|
||||
}
|
||||
|
||||
@@ -1547,19 +1546,42 @@ void Fl_Window::resize(int X,int Y,int W
|
||||
}
|
||||
}
|
||||
|
||||
-static void make_fullscreen(Fl_Window *w, Window xid, int X, int Y, int W, int H) {
|
||||
+void Fl_X::make_fullscreen(int X, int Y, int W, int H) {
|
||||
+ int top, bottom, left, right;
|
||||
int sx, sy, sw, sh;
|
||||
- Fl::screen_xywh(sx, sy, sw, sh, X, Y, W, H);
|
||||
+
|
||||
+ top = w->fullscreen_screen_top;
|
||||
+ bottom = w->fullscreen_screen_bottom;
|
||||
+ left = w->fullscreen_screen_left;
|
||||
+ right = w->fullscreen_screen_right;
|
||||
+
|
||||
+ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) {
|
||||
+ top = Fl::screen_num(X, Y, W, H);
|
||||
+ bottom = top;
|
||||
+ left = top;
|
||||
+ right = top;
|
||||
+ }
|
||||
+
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, top);
|
||||
+ Y = sy;
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, bottom);
|
||||
+ H = sy + sh - Y;
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, left);
|
||||
+ X = sx;
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, right);
|
||||
+ W = sx + sw - X;
|
||||
+
|
||||
DWORD flags = GetWindowLong(xid, GWL_STYLE);
|
||||
flags = flags & ~(WS_THICKFRAME|WS_CAPTION);
|
||||
SetWindowLong(xid, GWL_STYLE, flags);
|
||||
+
|
||||
// SWP_NOSENDCHANGING is so that we can override size limits
|
||||
- SetWindowPos(xid, HWND_TOP, sx, sy, sw, sh, SWP_NOSENDCHANGING | SWP_FRAMECHANGED);
|
||||
+ SetWindowPos(xid, HWND_TOP, X, Y, W, H, SWP_NOSENDCHANGING | SWP_FRAMECHANGED);
|
||||
}
|
||||
|
||||
void Fl_Window::fullscreen_x() {
|
||||
_set_fullscreen();
|
||||
- make_fullscreen(this, fl_xid(this), x(), y(), w(), h());
|
||||
+ i->make_fullscreen(x(), y(), w(), h());
|
||||
Fl::handle(FL_FULLSCREEN, this);
|
||||
}
|
||||
|
||||
@@ -1814,8 +1836,8 @@ Fl_X* Fl_X::make(Fl_Window* w) {
|
||||
monitor the window was placed on. */
|
||||
RECT rect;
|
||||
GetWindowRect(x->xid, &rect);
|
||||
- make_fullscreen(w, x->xid, rect.left, rect.top,
|
||||
- rect.right - rect.left, rect.bottom - rect.top);
|
||||
+ x->make_fullscreen(rect.left, rect.top,
|
||||
+ rect.right - rect.left, rect.bottom - rect.top);
|
||||
}
|
||||
|
||||
x->next = Fl_X::first;
|
||||
diff -urp fltk-1.3.2.org/src/Fl_Window_fullscreen.cxx fltk-1.3.2/src/Fl_Window_fullscreen.cxx
|
||||
--- fltk-1.3.2.org/src/Fl_Window_fullscreen.cxx 2012-11-06 21:46:14.000000000 +0100
|
||||
+++ fltk-1.3.2/src/Fl_Window_fullscreen.cxx 2013-01-16 10:52:47.879480608 +0100
|
||||
@@ -36,6 +36,10 @@ int Fl_Window::no_fullscreen_x = 0;
|
||||
int Fl_Window::no_fullscreen_y = 0;
|
||||
int Fl_Window::no_fullscreen_w = 0;
|
||||
int Fl_Window::no_fullscreen_h = 0;
|
||||
+int Fl_Window::fullscreen_screen_top = -1;
|
||||
+int Fl_Window::fullscreen_screen_bottom = -1;
|
||||
+int Fl_Window::fullscreen_screen_left = -1;
|
||||
+int Fl_Window::fullscreen_screen_right = -1;
|
||||
#endif
|
||||
|
||||
void Fl_Window::border(int b) {
|
||||
@@ -95,6 +99,23 @@ void Fl_Window::fullscreen_off() {
|
||||
fullscreen_off(no_fullscreen_x, no_fullscreen_y, no_fullscreen_w, no_fullscreen_h);
|
||||
}
|
||||
|
||||
+void Fl_Window::fullscreen_screens(int top, int bottom, int left, int right) {
|
||||
+ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) {
|
||||
+ fullscreen_screen_top = -1;
|
||||
+ fullscreen_screen_bottom = -1;
|
||||
+ fullscreen_screen_left = -1;
|
||||
+ fullscreen_screen_right = -1;
|
||||
+ } else {
|
||||
+ fullscreen_screen_top = top;
|
||||
+ fullscreen_screen_bottom = bottom;
|
||||
+ fullscreen_screen_left = left;
|
||||
+ fullscreen_screen_right = right;
|
||||
+ }
|
||||
+
|
||||
+ if (shown() && (flags() & Fl_Widget::FULLSCREEN))
|
||||
+ fullscreen_x();
|
||||
+}
|
||||
+
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Window_fullscreen.cxx 9706 2012-11-06 20:46:14Z matt $".
|
||||
diff -urp fltk-1.3.2.org/src/Fl_x.cxx fltk-1.3.2/src/Fl_x.cxx
|
||||
--- fltk-1.3.2.org/src/Fl_x.cxx 2013-01-16 10:52:33.020228202 +0100
|
||||
+++ fltk-1.3.2/src/Fl_x.cxx 2013-01-16 10:52:47.880480556 +0100
|
||||
@@ -344,6 +344,7 @@ Atom fl_NET_WM_ICON_NAME; // utf8 aware
|
||||
Atom fl_NET_SUPPORTING_WM_CHECK;
|
||||
Atom fl_NET_WM_STATE;
|
||||
Atom fl_NET_WM_STATE_FULLSCREEN;
|
||||
+Atom fl_NET_WM_FULLSCREEN_MONITORS;
|
||||
Atom fl_NET_WORKAREA;
|
||||
Atom fl_NET_WM_ICON;
|
||||
|
||||
@@ -709,6 +710,7 @@ void fl_open_display(Display* d) {
|
||||
fl_NET_SUPPORTING_WM_CHECK = XInternAtom(d, "_NET_SUPPORTING_WM_CHECK", 0);
|
||||
fl_NET_WM_STATE = XInternAtom(d, "_NET_WM_STATE", 0);
|
||||
fl_NET_WM_STATE_FULLSCREEN = XInternAtom(d, "_NET_WM_STATE_FULLSCREEN", 0);
|
||||
+ fl_NET_WM_FULLSCREEN_MONITORS = XInternAtom(d, "_NET_WM_FULLSCREEN_MONITORS", 0);
|
||||
fl_NET_WORKAREA = XInternAtom(d, "_NET_WORKAREA", 0);
|
||||
fl_NET_WM_ICON = XInternAtom(d, "_NET_WM_ICON", 0);
|
||||
|
||||
@@ -1872,22 +1874,30 @@ void Fl_Window::resize(int X,int Y,int W
|
||||
#define _NET_WM_STATE_ADD 1 /* add/set property */
|
||||
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
|
||||
|
||||
-static void send_wm_state_event(Window wnd, int add, Atom prop) {
|
||||
+static void send_wm_event(Window wnd, Atom message,
|
||||
+ unsigned long d0, unsigned long d1=0,
|
||||
+ unsigned long d2=0, unsigned long d3=0,
|
||||
+ unsigned long d4=0) {
|
||||
XEvent e;
|
||||
e.xany.type = ClientMessage;
|
||||
e.xany.window = wnd;
|
||||
- e.xclient.message_type = fl_NET_WM_STATE;
|
||||
+ e.xclient.message_type = message;
|
||||
e.xclient.format = 32;
|
||||
- e.xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
|
||||
- e.xclient.data.l[1] = prop;
|
||||
- e.xclient.data.l[2] = 0;
|
||||
- e.xclient.data.l[3] = 0;
|
||||
- e.xclient.data.l[4] = 0;
|
||||
+ e.xclient.data.l[0] = d0;
|
||||
+ e.xclient.data.l[1] = d1;
|
||||
+ e.xclient.data.l[2] = d2;
|
||||
+ e.xclient.data.l[3] = d3;
|
||||
+ e.xclient.data.l[4] = d4;
|
||||
XSendEvent(fl_display, RootWindow(fl_display, fl_screen),
|
||||
0, SubstructureNotifyMask | SubstructureRedirectMask,
|
||||
&e);
|
||||
}
|
||||
|
||||
+static void send_wm_state_event(Window wnd, int add, Atom prop) {
|
||||
+ send_wm_event(wnd, fl_NET_WM_STATE,
|
||||
+ add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE, prop);
|
||||
+}
|
||||
+
|
||||
int Fl_X::ewmh_supported() {
|
||||
static int result = -1;
|
||||
|
||||
@@ -1911,6 +1921,22 @@ int Fl_X::ewmh_supported() {
|
||||
/* Change an existing window to fullscreen */
|
||||
void Fl_Window::fullscreen_x() {
|
||||
if (Fl_X::ewmh_supported()) {
|
||||
+ int top, bottom, left, right;
|
||||
+
|
||||
+ top = fullscreen_screen_top;
|
||||
+ bottom = fullscreen_screen_bottom;
|
||||
+ left = fullscreen_screen_left;
|
||||
+ right = fullscreen_screen_right;
|
||||
+
|
||||
+ if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) {
|
||||
+ top = Fl::screen_num(x(), y(), w(), h());
|
||||
+ bottom = top;
|
||||
+ left = top;
|
||||
+ right = top;
|
||||
+ }
|
||||
+
|
||||
+ send_wm_event(fl_xid(this), fl_NET_WM_FULLSCREEN_MONITORS,
|
||||
+ top, bottom, left, right);
|
||||
send_wm_state_event(fl_xid(this), 1, fl_NET_WM_STATE_FULLSCREEN);
|
||||
} else {
|
||||
_set_fullscreen();
|
||||
@@ -1997,7 +2023,7 @@ void Fl_X::make_xid(Fl_Window* win, XVis
|
||||
// force the window to be on-screen. Usually the X window manager
|
||||
// does this, but a few don't, so we do it here for consistency:
|
||||
int scr_x, scr_y, scr_w, scr_h;
|
||||
- Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h, X, Y);
|
||||
+ Fl::screen_xywh(scr_x, scr_y, scr_w, scr_h, X, Y, W, H);
|
||||
|
||||
if (win->border()) {
|
||||
// ensure border is on screen:
|
||||
@@ -2026,6 +2052,23 @@ void Fl_X::make_xid(Fl_Window* win, XVis
|
||||
return;
|
||||
}
|
||||
|
||||
+ // Compute which screen(s) we should be on if we want to go fullscreen
|
||||
+ int fullscreen_top, fullscreen_bottom, fullscreen_left, fullscreen_right;
|
||||
+
|
||||
+ fullscreen_top = win->fullscreen_screen_top;
|
||||
+ fullscreen_bottom = win->fullscreen_screen_bottom;
|
||||
+ fullscreen_left = win->fullscreen_screen_left;
|
||||
+ fullscreen_right = win->fullscreen_screen_right;
|
||||
+
|
||||
+ if ((fullscreen_top < 0) || (fullscreen_bottom < 0) ||
|
||||
+ (fullscreen_left < 0) || (fullscreen_right < 0)) {
|
||||
+ fullscreen_top = Fl::screen_num(X, Y, W, H);
|
||||
+ fullscreen_bottom = fullscreen_top;
|
||||
+ fullscreen_left = fullscreen_top;
|
||||
+ fullscreen_right = fullscreen_top;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
ulong root = win->parent() ?
|
||||
fl_xid(win->window()) : RootWindow(fl_display, fl_screen);
|
||||
|
||||
@@ -2049,9 +2092,17 @@ void Fl_X::make_xid(Fl_Window* win, XVis
|
||||
// border, and cannot grab without an existing window. Besides,
|
||||
// there is no clear_override().
|
||||
if (win->flags() & Fl_Widget::FULLSCREEN && !Fl_X::ewmh_supported()) {
|
||||
+ int sx, sy, sw, sh;
|
||||
attr.override_redirect = 1;
|
||||
mask |= CWOverrideRedirect;
|
||||
- Fl::screen_xywh(X, Y, W, H, X, Y, W, H);
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_left);
|
||||
+ X = sx;
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_right);
|
||||
+ W = sx + sw - X;
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_top);
|
||||
+ Y = sy;
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, fullscreen_bottom);
|
||||
+ H = sy + sh - Y;
|
||||
}
|
||||
|
||||
if (fl_background_pixel >= 0) {
|
||||
@@ -2122,6 +2173,13 @@ void Fl_X::make_xid(Fl_Window* win, XVis
|
||||
|
||||
// If asked for, create fullscreen
|
||||
if (win->flags() & Fl_Widget::FULLSCREEN && Fl_X::ewmh_supported()) {
|
||||
+ unsigned long data[4];
|
||||
+ data[0] = fullscreen_top;
|
||||
+ data[1] = fullscreen_bottom;
|
||||
+ data[2] = fullscreen_left;
|
||||
+ data[3] = fullscreen_right;
|
||||
+ XChangeProperty (fl_display, xp->xid, fl_NET_WM_FULLSCREEN_MONITORS, XA_ATOM, 32,
|
||||
+ PropModeReplace, (unsigned char*) data, 4);
|
||||
XChangeProperty (fl_display, xp->xid, fl_NET_WM_STATE, XA_ATOM, 32,
|
||||
PropModeAppend, (unsigned char*) &fl_NET_WM_STATE_FULLSCREEN, 1);
|
||||
}
|
||||
diff -urp fltk-1.3.2.org/test/fullscreen.cxx fltk-1.3.2/test/fullscreen.cxx
|
||||
--- fltk-1.3.2.org/test/fullscreen.cxx 2012-06-14 17:09:46.000000000 +0200
|
||||
+++ fltk-1.3.2/test/fullscreen.cxx 2013-01-16 10:52:47.881104801 +0100
|
||||
@@ -127,7 +127,7 @@ class fullscreen_window : public Fl_Sing
|
||||
fullscreen_window(int W, int H, const char *t=0);
|
||||
int handle (int e);
|
||||
Fl_Toggle_Light_Button *b3;
|
||||
-
|
||||
+ Fl_Toggle_Light_Button *b4;
|
||||
};
|
||||
|
||||
fullscreen_window::fullscreen_window(int W, int H, const char *t) : Fl_Single_Window(W, H, t) {
|
||||
@@ -170,23 +170,54 @@ void border_cb(Fl_Widget *o, void *p) {
|
||||
#endif
|
||||
}
|
||||
|
||||
-int px,py,pw,ph;
|
||||
Fl_Button *border_button;
|
||||
void fullscreen_cb(Fl_Widget *o, void *p) {
|
||||
Fl_Window *w = (Fl_Window *)p;
|
||||
int d = ((Fl_Button *)o)->value();
|
||||
if (d) {
|
||||
- px = w->x();
|
||||
- py = w->y();
|
||||
- pw = w->w();
|
||||
- ph = w->h();
|
||||
+ if (((fullscreen_window*)w)->b4->value()) {
|
||||
+ int top, bottom, left, right;
|
||||
+ int top_y, bottom_y, left_x, right_x;
|
||||
+
|
||||
+ int sx, sy, sw, sh;
|
||||
+
|
||||
+ top = bottom = left = right = 0;
|
||||
+
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, 0);
|
||||
+ top_y = sy;
|
||||
+ bottom_y = sy + sh;
|
||||
+ left_x = sx;
|
||||
+ right_x = sx + sw;
|
||||
+
|
||||
+ for (int i = 1;i < Fl::screen_count();i++) {
|
||||
+ Fl::screen_xywh(sx, sy, sw, sh, i);
|
||||
+ if (sy < top_y) {
|
||||
+ top = i;
|
||||
+ top_y = sy;
|
||||
+ }
|
||||
+ if ((sy + sh) > bottom_y) {
|
||||
+ bottom = i;
|
||||
+ bottom_y = sy + sh;
|
||||
+ }
|
||||
+ if (sx < left_x) {
|
||||
+ left = i;
|
||||
+ left_x = sx;
|
||||
+ }
|
||||
+ if ((sx + sw) > right_x) {
|
||||
+ right = i;
|
||||
+ right_x = sx + sw;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ w->fullscreen_screens(top, bottom, left, right);
|
||||
+ } else {
|
||||
+ w->fullscreen_screens(-1, -1, -1, -1);
|
||||
+ }
|
||||
w->fullscreen();
|
||||
- w->override();
|
||||
#ifndef WIN32 // update our border state in case border was turned off
|
||||
border_button->value(w->border());
|
||||
#endif
|
||||
} else {
|
||||
- //w->fullscreen_off(px,py,pw,ph);
|
||||
w->fullscreen_off();
|
||||
}
|
||||
}
|
||||
@@ -219,7 +250,7 @@ void exit_cb(Fl_Widget *, void *) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
-#define NUMB 7
|
||||
+#define NUMB 8
|
||||
|
||||
int twowindow = 0;
|
||||
int initfull = 0;
|
||||
@@ -284,6 +315,9 @@ int main(int argc, char **argv) {
|
||||
window.b3->callback(fullscreen_cb,w);
|
||||
y+=30;
|
||||
|
||||
+ window.b4 = new Fl_Toggle_Light_Button(50,y,window.w()-60,30,"All Screens");
|
||||
+ y+=30;
|
||||
+
|
||||
Fl_Button eb(50,y,window.w()-60,30,"Exit");
|
||||
eb.callback(exit_cb);
|
||||
y+=30;
|
|
@ -1,44 +0,0 @@
|
|||
diff -up fltk-1.3.x-r9671/FL/Fl_Window.H.cursor-abi fltk-1.3.x-r9671/FL/Fl_Window.H
|
||||
--- fltk-1.3.x-r9671/FL/Fl_Window.H.cursor-abi 2012-12-04 12:39:42.419066193 +0100
|
||||
+++ fltk-1.3.x-r9671/FL/Fl_Window.H 2012-12-04 12:40:45.791122889 +0100
|
||||
@@ -467,15 +467,13 @@ public:
|
||||
|
||||
The type Fl_Cursor is an enumeration defined in <FL/Enumerations.H>.
|
||||
|
||||
+ The Fl_Color parameters are here only for backward compatibility.
|
||||
+
|
||||
\see cursor(const Fl_RGB_Image*, int, int), default_cursor()
|
||||
*/
|
||||
- void cursor(Fl_Cursor);
|
||||
+ void cursor(Fl_Cursor c, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
|
||||
void cursor(const Fl_RGB_Image*, int, int);
|
||||
- void default_cursor(Fl_Cursor);
|
||||
-
|
||||
- /* for legacy compatibility */
|
||||
- void cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE) { cursor(c); };
|
||||
- void default_cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE) { default_cursor(c); };
|
||||
+ void default_cursor(Fl_Cursor c, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
|
||||
|
||||
static void default_callback(Fl_Window*, void* v);
|
||||
|
||||
diff -up fltk-1.3.x-r9671/src/fl_cursor.cxx.cursor-abi fltk-1.3.x-r9671/src/fl_cursor.cxx
|
||||
--- fltk-1.3.x-r9671/src/fl_cursor.cxx.cursor-abi 2012-12-04 12:40:55.714131967 +0100
|
||||
+++ fltk-1.3.x-r9671/src/fl_cursor.cxx 2012-12-04 12:41:25.804159597 +0100
|
||||
@@ -55,7 +55,7 @@ void fl_cursor(Fl_Cursor c, Fl_Color fg,
|
||||
|
||||
\see cursor(const Fl_RGB_Image*, int, int), default_cursor()
|
||||
*/
|
||||
-void Fl_Window::default_cursor(Fl_Cursor c) {
|
||||
+void Fl_Window::default_cursor(Fl_Cursor c, Fl_Color, Fl_Color) {
|
||||
cursor_default = c;
|
||||
cursor(c);
|
||||
}
|
||||
@@ -108,7 +108,7 @@ void fallback_cursor(Fl_Window *w, Fl_Cu
|
||||
}
|
||||
|
||||
|
||||
-void Fl_Window::cursor(Fl_Cursor c) {
|
||||
+void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) {
|
||||
int ret;
|
||||
|
||||
// the cursor must be set for the top level window, not for subwindows
|
|
@ -1,286 +0,0 @@
|
|||
diff -ur fltk-1.3.0r9619.org/FL/Fl_Widget.H fltk-1.3.0r9619/FL/Fl_Widget.H
|
||||
--- fltk-1.3.0r9619.org/FL/Fl_Widget.H 2012-04-23 22:12:06.000000000 +0200
|
||||
+++ fltk-1.3.0r9619/FL/Fl_Widget.H 2012-06-18 13:46:07.302320825 +0200
|
||||
@@ -171,6 +171,7 @@
|
||||
GROUP_RELATIVE = 1<<16, ///< position this widget relative to the parent group, not to the window
|
||||
COPIED_TOOLTIP = 1<<17, ///< the widget tooltip is internally copied, its destruction is handled by the widget
|
||||
FULLSCREEN = 1<<18, ///< a fullscreen window (Fl_Window)
|
||||
+ SIMPLE_KEYBOARD = 1<<19, ///< the widget wants simple, consistent keypresses and not advanced input (like character composition and CJK input)
|
||||
// (space for more flags)
|
||||
USERFLAG3 = 1<<29, ///< reserved for 3rd party extensions
|
||||
USERFLAG2 = 1<<30, ///< reserved for 3rd party extensions
|
||||
@@ -776,6 +777,35 @@
|
||||
*/
|
||||
void clear_changed() {flags_ &= ~CHANGED;}
|
||||
|
||||
+ /**
|
||||
+ Returns if the widget sees a simplified keyboard model or not.
|
||||
+
|
||||
+ Normally widgets get a full-featured keyboard model that is geared
|
||||
+ towards text input. This includes support for compose sequences and
|
||||
+ advanced input methods, commonly used for asian writing system. This
|
||||
+ system however has downsides in that extra graphic can be presented
|
||||
+ to the user and that a physical key press doesn't correspond directly
|
||||
+ to a FLTK event.
|
||||
+
|
||||
+ Widgets that need a direct correspondence between actual key events
|
||||
+ and those seen by the widget can swith to the simplified keyboard
|
||||
+ model.
|
||||
+
|
||||
+ \retval 0 if the widget uses the normal keyboard model
|
||||
+ \see set_changed(), clear_changed()
|
||||
+ */
|
||||
+ unsigned int simple_keyboard() const {return flags_&SIMPLE_KEYBOARD;}
|
||||
+
|
||||
+ /** Marks a widget to use the simple keyboard model.
|
||||
+ \see changed(), clear_changed()
|
||||
+ */
|
||||
+ void set_simple_keyboard() {flags_ |= SIMPLE_KEYBOARD;}
|
||||
+
|
||||
+ /** Marks a widget to use the normal keyboard model.
|
||||
+ \see changed(), set_changed()
|
||||
+ */
|
||||
+ void set_normal_keyboard() {flags_ &= ~SIMPLE_KEYBOARD;}
|
||||
+
|
||||
/** Gives the widget the keyboard focus.
|
||||
Tries to make this widget be the Fl::focus() widget, by first sending
|
||||
it an FL_FOCUS event, and if it returns non-zero, setting
|
||||
diff -ur fltk-1.3.0r9619.org/src/Fl.cxx fltk-1.3.0r9619/src/Fl.cxx
|
||||
--- fltk-1.3.0r9619.org/src/Fl.cxx 2012-03-23 17:47:53.000000000 +0100
|
||||
+++ fltk-1.3.0r9619/src/Fl.cxx 2012-06-18 13:46:07.303320877 +0200
|
||||
@@ -70,6 +70,8 @@
|
||||
extern double fl_mac_flush_and_wait(double time_to_wait, char in_idle);
|
||||
#endif // WIN32
|
||||
|
||||
+extern void fl_update_focus(void);
|
||||
+
|
||||
//
|
||||
// Globals...
|
||||
//
|
||||
@@ -876,6 +878,8 @@
|
||||
fl_oldfocus = p;
|
||||
}
|
||||
e_number = old_event;
|
||||
+ // let the platform code do what it needs
|
||||
+ fl_update_focus();
|
||||
}
|
||||
}
|
||||
|
||||
diff -ur fltk-1.3.0r9619.org/src/Fl_grab.cxx fltk-1.3.0r9619/src/Fl_grab.cxx
|
||||
--- fltk-1.3.0r9619.org/src/Fl_grab.cxx 2012-03-23 17:47:53.000000000 +0100
|
||||
+++ fltk-1.3.0r9619/src/Fl_grab.cxx 2012-06-18 13:46:07.303320877 +0200
|
||||
@@ -29,6 +29,7 @@
|
||||
// override_redirect, it does similar things on WIN32.
|
||||
|
||||
extern void fl_fix_focus(); // in Fl.cxx
|
||||
+void fl_update_focus(void);
|
||||
|
||||
#ifdef WIN32
|
||||
// We have to keep track of whether we have captured the mouse, since
|
||||
@@ -80,6 +81,7 @@
|
||||
#endif
|
||||
}
|
||||
grab_ = win;
|
||||
+ fl_update_focus();
|
||||
} else {
|
||||
if (grab_) {
|
||||
#ifdef WIN32
|
||||
@@ -98,6 +100,7 @@
|
||||
XFlush(fl_display);
|
||||
#endif
|
||||
grab_ = 0;
|
||||
+ fl_update_focus();
|
||||
fl_fix_focus();
|
||||
}
|
||||
}
|
||||
diff -ur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx
|
||||
--- fltk-1.3.0r9619.org/src/Fl_x.cxx 2012-06-18 13:46:07.205316173 +0200
|
||||
+++ fltk-1.3.0r9619/src/Fl_x.cxx 2012-06-18 13:46:18.216844629 +0200
|
||||
@@ -298,6 +298,7 @@
|
||||
Colormap fl_colormap;
|
||||
XIM fl_xim_im = 0;
|
||||
XIC fl_xim_ic = 0;
|
||||
+Window fl_xim_win = 0;
|
||||
char fl_is_over_the_spot = 0;
|
||||
static XRectangle status_area;
|
||||
|
||||
@@ -583,6 +584,65 @@
|
||||
if(xim_styles) XFree(xim_styles);
|
||||
}
|
||||
|
||||
+void fl_xim_deactivate(void);
|
||||
+
|
||||
+void fl_xim_activate(Window xid)
|
||||
+{
|
||||
+ if (!fl_xim_im)
|
||||
+ return;
|
||||
+
|
||||
+ // If the focused window has changed, then use the brute force method
|
||||
+ // of completely recreating the input context.
|
||||
+ if (fl_xim_win != xid) {
|
||||
+ fl_xim_deactivate();
|
||||
+
|
||||
+ fl_new_ic();
|
||||
+ fl_xim_win = xid;
|
||||
+
|
||||
+ XSetICValues(fl_xim_ic,
|
||||
+ XNFocusWindow, fl_xim_win,
|
||||
+ XNClientWindow, fl_xim_win,
|
||||
+ NULL);
|
||||
+ }
|
||||
+
|
||||
+ fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height);
|
||||
+}
|
||||
+
|
||||
+void fl_xim_deactivate(void)
|
||||
+{
|
||||
+ if (!fl_xim_ic)
|
||||
+ return;
|
||||
+
|
||||
+ XDestroyIC(fl_xim_ic);
|
||||
+ fl_xim_ic = NULL;
|
||||
+
|
||||
+ fl_xim_win = 0;
|
||||
+}
|
||||
+
|
||||
+extern Fl_Window *fl_xfocus;
|
||||
+
|
||||
+void fl_update_focus(void)
|
||||
+{
|
||||
+ Fl_Widget *focus;
|
||||
+
|
||||
+ focus = Fl::grab();
|
||||
+ if (!focus)
|
||||
+ focus = Fl::focus();
|
||||
+ if (!focus)
|
||||
+ return;
|
||||
+
|
||||
+ if (focus->simple_keyboard()) {
|
||||
+ fl_xim_deactivate();
|
||||
+ } else {
|
||||
+ // fl_xfocus should always be set if something has focus, but let's
|
||||
+ // play it safe
|
||||
+ if (!fl_xfocus || !fl_xid(fl_xfocus))
|
||||
+ return;
|
||||
+
|
||||
+ fl_xim_activate(fl_xid(fl_xfocus));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void fl_open_display() {
|
||||
if (fl_display) return;
|
||||
|
||||
@@ -917,10 +977,9 @@
|
||||
XEvent xevent = thisevent;
|
||||
fl_xevent = &thisevent;
|
||||
Window xid = xevent.xany.window;
|
||||
- static Window xim_win = 0;
|
||||
|
||||
if (fl_xim_ic && xevent.type == DestroyNotify &&
|
||||
- xid != xim_win && !fl_find(xid))
|
||||
+ xid != fl_xim_win && !fl_find(xid))
|
||||
{
|
||||
XIM xim_im;
|
||||
xim_im = XOpenIM(fl_display, NULL, NULL, NULL);
|
||||
@@ -935,48 +994,10 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (fl_xim_ic && (xevent.type == FocusIn))
|
||||
- {
|
||||
-#define POOR_XIM
|
||||
-#ifdef POOR_XIM
|
||||
- if (xim_win != xid)
|
||||
- {
|
||||
- xim_win = xid;
|
||||
- XDestroyIC(fl_xim_ic);
|
||||
- fl_xim_ic = NULL;
|
||||
- fl_new_ic();
|
||||
- XSetICValues(fl_xim_ic,
|
||||
- XNFocusWindow, xevent.xclient.window,
|
||||
- XNClientWindow, xid,
|
||||
- NULL);
|
||||
- }
|
||||
- fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height);
|
||||
-#else
|
||||
- if (Fl::first_window() && Fl::first_window()->modal()) {
|
||||
- Window x = fl_xid(Fl::first_window());
|
||||
- if (x != xim_win) {
|
||||
- xim_win = x;
|
||||
- XSetICValues(fl_xim_ic,
|
||||
- XNFocusWindow, xim_win,
|
||||
- XNClientWindow, xim_win,
|
||||
- NULL);
|
||||
- fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height);
|
||||
- }
|
||||
- } else if (xim_win != xid && xid) {
|
||||
- xim_win = xid;
|
||||
- XSetICValues(fl_xim_ic,
|
||||
- XNFocusWindow, xevent.xclient.window,
|
||||
- XNClientWindow, xid,
|
||||
- //XNFocusWindow, xim_win,
|
||||
- //XNClientWindow, xim_win,
|
||||
- NULL);
|
||||
- fl_set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height);
|
||||
- }
|
||||
-#endif
|
||||
+ if (fl_xim_ic) {
|
||||
+ if (XFilterEvent((XEvent *)&xevent, 0))
|
||||
+ return 1;
|
||||
}
|
||||
-
|
||||
- if ( XFilterEvent((XEvent *)&xevent, 0) )
|
||||
- return(1);
|
||||
|
||||
#if USE_XRANDR
|
||||
if( XRRUpdateConfiguration_f && xevent.type == randrEventBase + RRScreenChangeNotify) {
|
||||
@@ -1326,15 +1347,15 @@
|
||||
//static XComposeStatus compose;
|
||||
len = XLookupString((XKeyEvent*)&(xevent.xkey),
|
||||
buffer, buffer_len, &keysym, 0/*&compose*/);
|
||||
- if (keysym && keysym < 0x400) { // a character in latin-1,2,3,4 sets
|
||||
- // force it to type a character (not sure if this ever is needed):
|
||||
- // if (!len) {buffer[0] = char(keysym); len = 1;}
|
||||
- len = fl_utf8encode(XKeysymToUcs(keysym), buffer);
|
||||
- if (len < 1) len = 1;
|
||||
- // ignore all effects of shift on the keysyms, which makes it a lot
|
||||
- // easier to program shortcuts and is Windoze-compatible:
|
||||
- keysym = XKeycodeToKeysym(fl_display, keycode, 0);
|
||||
- }
|
||||
+ // XLookupString() is only defined to return Latin-1 (although it
|
||||
+ // often gives you more). To be safe, use our own lookups based on
|
||||
+ // keysym.
|
||||
+ len = fl_utf8encode(XKeysymToUcs(keysym), buffer);
|
||||
+ if (len < 1)
|
||||
+ len = 1;
|
||||
+ // ignore all effects of shift on the keysyms, which makes it a lot
|
||||
+ // easier to program shortcuts and is Windoze-compatable:
|
||||
+ keysym = XKeycodeToKeysym(fl_display, keycode, 0);
|
||||
}
|
||||
// MRS: Can't use Fl::event_state(FL_CTRL) since the state is not
|
||||
// set until set_event_xy() is called later...
|
||||
diff -ur fltk-1.3.0r9619.org/src/xutf8/imKStoUCS.c fltk-1.3.0r9619/src/xutf8/imKStoUCS.c
|
||||
--- fltk-1.3.0r9619.org/src/xutf8/imKStoUCS.c 2009-03-13 23:43:43.000000000 +0100
|
||||
+++ fltk-1.3.0r9619/src/xutf8/imKStoUCS.c 2012-06-18 13:46:07.304320930 +0200
|
||||
@@ -266,6 +266,12 @@
|
||||
0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */
|
||||
};
|
||||
|
||||
+static unsigned short const keysym_to_unicode_fe50_fe60[] = {
|
||||
+ 0x0300, 0x0301, 0x0302, 0x0303, 0x0304, 0x0306, 0x0307, 0x0308, /* 0xfe50-0xfe57 */
|
||||
+ 0x030a, 0x030b, 0x030c, 0x0327, 0x0328, 0x1da5, 0x3099, 0x309a, /* 0xfe58-0xfe5f */
|
||||
+ 0x0323 /* 0xfe60-0xfe67 */
|
||||
+};
|
||||
+
|
||||
unsigned int
|
||||
KeySymToUcs4(KeySym keysym)
|
||||
{
|
||||
@@ -315,6 +321,8 @@
|
||||
return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f];
|
||||
else if (keysym > 0x209f && keysym < 0x20ad)
|
||||
return keysym_to_unicode_20a0_20ac[keysym - 0x20a0];
|
||||
+ else if (keysym > 0xfe4f && keysym < 0xfe61)
|
||||
+ return keysym_to_unicode_fe50_fe60[keysym - 0xfe50];
|
||||
else
|
||||
return 0;
|
||||
}
|
|
@ -1,355 +0,0 @@
|
|||
diff -up fltk-1.3.2/CMakeLists.txt.clp-x11 fltk-1.3.2/CMakeLists.txt
|
||||
--- fltk-1.3.2/CMakeLists.txt.clp-x11 2012-09-13 16:19:01.000000000 +0200
|
||||
+++ fltk-1.3.2/CMakeLists.txt 2013-01-30 15:56:25.810663430 +0100
|
||||
@@ -515,6 +515,20 @@ else()
|
||||
endif(OPTION_USE_XINERAMA)
|
||||
|
||||
#######################################################################
|
||||
+if(X11_Xfixes_FOUND)
|
||||
+ option(OPTION_USE_XFIXES "use lib XFIXES" ON)
|
||||
+endif(X11_Xfixes_FOUND)
|
||||
+
|
||||
+if(OPTION_USE_XFIXES)
|
||||
+ set(HAVE_XFIXES ${X11_Xfixes_FOUND})
|
||||
+ include_directories(${X11_Xfixes_INCLUDE_PATH})
|
||||
+ list(APPEND FLTK_LDLIBS -lXfixes)
|
||||
+ set(FLTK_XFIXES_FOUND TRUE)
|
||||
+else()
|
||||
+ set(FLTK_XFIXES_FOUND FALSE)
|
||||
+endif(OPTION_USE_XFIXES)
|
||||
+
|
||||
+#######################################################################
|
||||
if(X11_Xft_FOUND)
|
||||
option(OPTION_USE_XFT "use lib Xft" ON)
|
||||
endif(X11_Xft_FOUND)
|
||||
diff -up fltk-1.3.2/configh.cmake.in.clp-x11 fltk-1.3.2/configh.cmake.in
|
||||
--- fltk-1.3.2/configh.cmake.in.clp-x11 2011-07-19 06:49:30.000000000 +0200
|
||||
+++ fltk-1.3.2/configh.cmake.in 2013-01-30 15:56:25.810663430 +0100
|
||||
@@ -108,6 +108,14 @@
|
||||
#define USE_XDBE HAVE_XDBE
|
||||
|
||||
/*
|
||||
+ * HAVE_XFIXES:
|
||||
+ *
|
||||
+ * Do we have the X fixes extension?
|
||||
+ */
|
||||
+
|
||||
+#cmakedefine01 HAVE_XFIXES
|
||||
+
|
||||
+/*
|
||||
* __APPLE_QUARTZ__:
|
||||
*
|
||||
* If __APPLE_QUARTZ__ is defined, FLTK will be
|
||||
diff -up fltk-1.3.2/configh.in.clp-x11 fltk-1.3.2/configh.in
|
||||
--- fltk-1.3.2/configh.in.clp-x11 2011-10-04 11:21:47.000000000 +0200
|
||||
+++ fltk-1.3.2/configh.in 2013-01-30 15:56:25.810663430 +0100
|
||||
@@ -108,6 +108,14 @@
|
||||
#define USE_XDBE HAVE_XDBE
|
||||
|
||||
/*
|
||||
+ * HAVE_XFIXES:
|
||||
+ *
|
||||
+ * Do we have the X fixes extension?
|
||||
+ */
|
||||
+
|
||||
+#define HAVE_XFIXES 0
|
||||
+
|
||||
+/*
|
||||
* __APPLE_QUARTZ__:
|
||||
*
|
||||
* All Apple implementations are now based on Quartz and Cocoa,
|
||||
diff -up fltk-1.3.2/configure.in.clp-x11 fltk-1.3.2/configure.in
|
||||
--- fltk-1.3.2/configure.in.clp-x11 2013-01-30 15:56:25.802663573 +0100
|
||||
+++ fltk-1.3.2/configure.in 2013-01-30 15:56:25.810663430 +0100
|
||||
@@ -999,6 +999,16 @@ case $uname_GUI in
|
||||
LIBS="-lXext $LIBS")
|
||||
fi
|
||||
|
||||
+ dnl Check for the Xfixes extension unless disabled...
|
||||
+ AC_ARG_ENABLE(xfixes, [ --enable-xfixes turn on Xfixes support [default=yes]])
|
||||
+
|
||||
+ if test x$enable_xfixes != xno; then
|
||||
+ AC_CHECK_HEADER(X11/extensions/Xfixes.h, AC_DEFINE(HAVE_XFIXES),,
|
||||
+ [#include <X11/Xlib.h>])
|
||||
+ AC_CHECK_LIB(Xfixes, XFixesQueryExtension,
|
||||
+ LIBS="-lXfixes $LIBS")
|
||||
+ fi
|
||||
+
|
||||
dnl Check for overlay visuals...
|
||||
AC_PATH_PROG(XPROP, xprop)
|
||||
AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay,
|
||||
diff -up fltk-1.3.2/fluid/CMakeLists.txt.clp-x11 fltk-1.3.2/fluid/CMakeLists.txt
|
||||
diff -up fltk-1.3.2/src/CMakeLists.txt.clp-x11 fltk-1.3.2/src/CMakeLists.txt
|
||||
--- fltk-1.3.2/src/CMakeLists.txt.clp-x11 2013-01-30 16:06:00.785430590 +0100
|
||||
+++ fltk-1.3.2/src/CMakeLists.txt 2013-01-30 16:06:17.883126642 +0100
|
||||
@@ -243,6 +243,10 @@ if(HAVE_XINERAMA)
|
||||
target_link_libraries(fltk ${X11_Xinerama_LIB})
|
||||
endif(HAVE_XINERAMA)
|
||||
|
||||
+if(HAVE_XFIXES)
|
||||
+ target_link_libraries(fltk ${X11_Xfixes_LIB})
|
||||
+endif(HAVE_XFIXES)
|
||||
+
|
||||
if(USE_XFT)
|
||||
target_link_libraries(fltk ${X11_Xft_LIB})
|
||||
endif(USE_XFT)
|
||||
diff -up fltk-1.3.2/src/Fl_x.cxx.clp-x11 fltk-1.3.2/src/Fl_x.cxx
|
||||
--- fltk-1.3.2/src/Fl_x.cxx.clp-x11 2013-01-30 15:56:25.793663733 +0100
|
||||
+++ fltk-1.3.2/src/Fl_x.cxx 2013-01-30 16:03:37.355981103 +0100
|
||||
@@ -53,6 +53,12 @@ static XRRUpdateConfiguration_type XRRUp
|
||||
static int randrEventBase; // base of RandR-defined events
|
||||
#endif
|
||||
|
||||
+# if HAVE_XFIXES
|
||||
+# include <X11/extensions/Xfixes.h>
|
||||
+static int xfixes_event_base = 0;
|
||||
+static bool have_xfixes = false;
|
||||
+# endif
|
||||
+
|
||||
static Fl_Xlib_Graphics_Driver fl_xlib_driver;
|
||||
static Fl_Display_Device fl_xlib_display(&fl_xlib_driver);
|
||||
Fl_Display_Device *Fl_Display_Device::_display = &fl_xlib_display;// the platform display
|
||||
@@ -307,6 +313,9 @@ static Atom WM_PROTOCOLS;
|
||||
static Atom fl_MOTIF_WM_HINTS;
|
||||
static Atom TARGETS;
|
||||
static Atom CLIPBOARD;
|
||||
+static Atom TIMESTAMP;
|
||||
+static Atom PRIMARY_TIMESTAMP;
|
||||
+static Atom CLIPBOARD_TIMESTAMP;
|
||||
Atom fl_XdndAware;
|
||||
Atom fl_XdndSelection;
|
||||
Atom fl_XdndEnter;
|
||||
@@ -667,6 +676,9 @@ void fl_open_display(Display* d) {
|
||||
fl_MOTIF_WM_HINTS = XInternAtom(d, "_MOTIF_WM_HINTS", 0);
|
||||
TARGETS = XInternAtom(d, "TARGETS", 0);
|
||||
CLIPBOARD = XInternAtom(d, "CLIPBOARD", 0);
|
||||
+ TIMESTAMP = XInternAtom(d, "TIMESTAMP", 0);
|
||||
+ PRIMARY_TIMESTAMP = XInternAtom(d, "PRIMARY_TIMESTAMP", 0);
|
||||
+ CLIPBOARD_TIMESTAMP = XInternAtom(d, "CLIPBOARD_TIMESTAMP", 0);
|
||||
fl_XdndAware = XInternAtom(d, "XdndAware", 0);
|
||||
fl_XdndSelection = XInternAtom(d, "XdndSelection", 0);
|
||||
fl_XdndEnter = XInternAtom(d, "XdndEnter", 0);
|
||||
@@ -713,6 +725,15 @@ void fl_open_display(Display* d) {
|
||||
#if !USE_COLORMAP
|
||||
Fl::visual(FL_RGB);
|
||||
#endif
|
||||
+
|
||||
+#if HAVE_XFIXES
|
||||
+ int error_base;
|
||||
+ if (XFixesQueryExtension(fl_display, &xfixes_event_base, &error_base))
|
||||
+ have_xfixes = true;
|
||||
+ else
|
||||
+ have_xfixes = false;
|
||||
+#endif
|
||||
+
|
||||
#if USE_XRANDR
|
||||
void *libxrandr_addr = dlopen("libXrandr.so.2", RTLD_LAZY);
|
||||
if (!libxrandr_addr) libxrandr_addr = dlopen("libXrandr.so", RTLD_LAZY);
|
||||
@@ -901,6 +922,107 @@ void Fl::copy(const char *stuff, int len
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
+// Code for tracking clipboard changes:
|
||||
+
|
||||
+static Time primary_timestamp = -1;
|
||||
+static Time clipboard_timestamp = -1;
|
||||
+
|
||||
+extern bool fl_clipboard_notify_empty(void);
|
||||
+extern void fl_trigger_clipboard_notify(int source);
|
||||
+
|
||||
+static void poll_clipboard_owner(void) {
|
||||
+ Window xid;
|
||||
+
|
||||
+#if HAVE_XFIXES
|
||||
+ // No polling needed with Xfixes
|
||||
+ if (have_xfixes)
|
||||
+ return;
|
||||
+#endif
|
||||
+
|
||||
+ // No one is interested, so no point polling
|
||||
+ if (fl_clipboard_notify_empty())
|
||||
+ return;
|
||||
+
|
||||
+ // We need a window for this to work
|
||||
+ if (!Fl::first_window())
|
||||
+ return;
|
||||
+ xid = fl_xid(Fl::first_window());
|
||||
+ if (!xid)
|
||||
+ return;
|
||||
+
|
||||
+ // Request an update of the selection time for both the primary and
|
||||
+ // clipboard selections. Magic continues when we get a SelectionNotify.
|
||||
+ if (!fl_i_own_selection[0])
|
||||
+ XConvertSelection(fl_display, XA_PRIMARY, TIMESTAMP, PRIMARY_TIMESTAMP,
|
||||
+ xid, fl_event_time);
|
||||
+ if (!fl_i_own_selection[1])
|
||||
+ XConvertSelection(fl_display, CLIPBOARD, TIMESTAMP, CLIPBOARD_TIMESTAMP,
|
||||
+ xid, fl_event_time);
|
||||
+}
|
||||
+
|
||||
+static void clipboard_timeout(void *data)
|
||||
+{
|
||||
+ // No one is interested, so stop polling
|
||||
+ if (fl_clipboard_notify_empty())
|
||||
+ return;
|
||||
+
|
||||
+ poll_clipboard_owner();
|
||||
+
|
||||
+ Fl::repeat_timeout(0.5, clipboard_timeout);
|
||||
+}
|
||||
+
|
||||
+static void handle_clipboard_timestamp(int clipboard, Time time)
|
||||
+{
|
||||
+ Time *timestamp;
|
||||
+
|
||||
+ timestamp = clipboard ? &clipboard_timestamp : &primary_timestamp;
|
||||
+
|
||||
+#if HAVE_XFIXES
|
||||
+ if (!have_xfixes)
|
||||
+#endif
|
||||
+ {
|
||||
+ // Initial scan, just store the value
|
||||
+ if (*timestamp == (Time)-1) {
|
||||
+ *timestamp = time;
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Same selection
|
||||
+ if (time == *timestamp)
|
||||
+ return;
|
||||
+
|
||||
+ *timestamp = time;
|
||||
+
|
||||
+ // The clipboard change is the event that caused us to request
|
||||
+ // the clipboard data, so use that time as the latest event.
|
||||
+ if (time > fl_event_time)
|
||||
+ fl_event_time = time;
|
||||
+
|
||||
+ // Something happened! Let's tell someone!
|
||||
+ fl_trigger_clipboard_notify(clipboard);
|
||||
+}
|
||||
+
|
||||
+void fl_clipboard_notify_change() {
|
||||
+ // Reset the timestamps if we've going idle so that you don't
|
||||
+ // get a bogus immediate trigger next time they're activated.
|
||||
+ if (fl_clipboard_notify_empty()) {
|
||||
+ primary_timestamp = -1;
|
||||
+ clipboard_timestamp = -1;
|
||||
+ } else {
|
||||
+#if HAVE_XFIXES
|
||||
+ if (!have_xfixes)
|
||||
+#endif
|
||||
+ {
|
||||
+ poll_clipboard_owner();
|
||||
+
|
||||
+ if (!Fl::has_timeout(clipboard_timeout))
|
||||
+ Fl::add_timeout(0.5, clipboard_timeout);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+////////////////////////////////////////////////////////////////
|
||||
|
||||
const XEvent* fl_xevent; // the current x event
|
||||
ulong fl_event_time; // the last timestamp from an x event
|
||||
@@ -1024,7 +1141,6 @@ int fl_handle(const XEvent& thisevent)
|
||||
return 0;
|
||||
|
||||
case SelectionNotify: {
|
||||
- if (!fl_selection_requestor) return 0;
|
||||
static unsigned char* buffer = 0;
|
||||
if (buffer) {XFree(buffer); buffer = 0;}
|
||||
long bytesread = 0;
|
||||
@@ -1040,6 +1156,19 @@ int fl_handle(const XEvent& thisevent)
|
||||
bytesread/4, 65536, 1, 0,
|
||||
&actual, &format, &count, &remaining,
|
||||
&portion)) break; // quit on error
|
||||
+
|
||||
+ if ((fl_xevent->xselection.property == PRIMARY_TIMESTAMP) ||
|
||||
+ (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP)) {
|
||||
+ if (portion && format == 32 && count == 1) {
|
||||
+ Time t = *(unsigned int*)portion;
|
||||
+ if (fl_xevent->xselection.property == CLIPBOARD_TIMESTAMP)
|
||||
+ handle_clipboard_timestamp(1, t);
|
||||
+ else
|
||||
+ handle_clipboard_timestamp(0, t);
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
if (actual == TARGETS || actual == XA_ATOM) {
|
||||
Atom type = XA_STRING;
|
||||
for (unsigned i = 0; i<count; i++) {
|
||||
@@ -1076,6 +1205,9 @@ int fl_handle(const XEvent& thisevent)
|
||||
buffer[bytesread] = 0;
|
||||
convert_crlf(buffer, bytesread);
|
||||
}
|
||||
+
|
||||
+ if (!fl_selection_requestor) return 0;
|
||||
+
|
||||
Fl::e_text = buffer ? (char*)buffer : (char *)"";
|
||||
Fl::e_length = bytesread;
|
||||
int old_event = Fl::e_number;
|
||||
@@ -1096,6 +1228,7 @@ int fl_handle(const XEvent& thisevent)
|
||||
case SelectionClear: {
|
||||
int clipboard = fl_xevent->xselectionclear.selection == CLIPBOARD;
|
||||
fl_i_own_selection[clipboard] = 0;
|
||||
+ poll_clipboard_owner();
|
||||
return 1;}
|
||||
|
||||
case SelectionRequest: {
|
||||
@@ -1308,6 +1441,9 @@ int fl_handle(const XEvent& thisevent)
|
||||
case FocusIn:
|
||||
if (fl_xim_ic) XSetICFocus(fl_xim_ic);
|
||||
event = FL_FOCUS;
|
||||
+ // If the user has toggled from another application to this one,
|
||||
+ // then it's a good time to check for clipboard changes.
|
||||
+ poll_clipboard_owner();
|
||||
break;
|
||||
|
||||
case FocusOut:
|
||||
@@ -1676,6 +1812,25 @@ int fl_handle(const XEvent& thisevent)
|
||||
}
|
||||
}
|
||||
|
||||
+#if HAVE_XFIXES
|
||||
+ switch (xevent.type - xfixes_event_base) {
|
||||
+ case XFixesSelectionNotify: {
|
||||
+ // Someone feeding us bogus events?
|
||||
+ if (!have_xfixes)
|
||||
+ return true;
|
||||
+
|
||||
+ XFixesSelectionNotifyEvent *selection_notify = (XFixesSelectionNotifyEvent *)&xevent;
|
||||
+
|
||||
+ if ((selection_notify->selection == XA_PRIMARY) && !fl_i_own_selection[0])
|
||||
+ handle_clipboard_timestamp(0, selection_notify->selection_timestamp);
|
||||
+ else if ((selection_notify->selection == CLIPBOARD) && !fl_i_own_selection[1])
|
||||
+ handle_clipboard_timestamp(1, selection_notify->selection_timestamp);
|
||||
+
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
return Fl::handle(event, window);
|
||||
}
|
||||
|
||||
@@ -1995,6 +2150,16 @@ void Fl_X::make_xid(Fl_Window* win, XVis
|
||||
XChangeProperty(fl_display, xp->xid, net_wm_type, XA_ATOM, 32, PropModeReplace, (unsigned char*)&net_wm_type_kind, 1);
|
||||
}
|
||||
|
||||
+#if HAVE_XFIXES
|
||||
+ // register for clipboard change notifications
|
||||
+ if (have_xfixes && !win->parent()) {
|
||||
+ XFixesSelectSelectionInput(fl_display, xp->xid, XA_PRIMARY,
|
||||
+ XFixesSetSelectionOwnerNotifyMask);
|
||||
+ XFixesSelectSelectionInput(fl_display, xp->xid, CLIPBOARD,
|
||||
+ XFixesSetSelectionOwnerNotifyMask);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
XMapWindow(fl_display, xp->xid);
|
||||
if (showit) {
|
||||
win->set_visible();
|
||||
diff -up fltk-1.3.2/test/CMakeLists.txt.clp-x11 fltk-1.3.2/test/CMakeLists.txt
|
59
fltk.spec
59
fltk.spec
|
@ -1,47 +1,32 @@
|
|||
%define major 1.3
|
||||
%define soname 0
|
||||
%define libname %mklibname %{name} %{soname}
|
||||
%define libforms %mklibname %{name}_forms %{soname}
|
||||
%define libgl %mklibname %{name}_gl %{soname}
|
||||
%define libimages %mklibname %{name}_images %{soname}
|
||||
%define libname %mklibname %{name} %{major}
|
||||
%define libforms %mklibname %{name}_forms %{major}
|
||||
%define libgl %mklibname %{name}_gl %{major}
|
||||
%define libimages %mklibname %{name}_images %{major}
|
||||
%define devname %mklibname %{name} -d
|
||||
|
||||
Summary: Fast Light Tool Kit (FLTK)
|
||||
Name: fltk
|
||||
Version: 1.3.2
|
||||
Release: 11
|
||||
Version: 1.3.3
|
||||
Release: 1
|
||||
License: LGPLv2.1+
|
||||
Group: System/Libraries
|
||||
Url: http://www.fltk.org
|
||||
Source0: ftp://ftp.easysw.com/pub/fltk/%{version}/%{name}-%{version}-source.tar.gz
|
||||
Patch0: fltk-1.3.0-link.patch
|
||||
Patch0: fltk-1.3.3-link.patch
|
||||
## FIXME/TODO: upstream these asap -- Rex
|
||||
# add lib64 support, drop extraneous libs (bug #708185) and ldflags (#1112930)
|
||||
Patch1: fltk-1.3.2-fltk_config.patch
|
||||
# libfltk_gl.so had undefined symbols
|
||||
Patch3: fltk-1.1.x-r5750-undefined.patch
|
||||
Patch5: fltk-1.1.8-fluid_desktop.patch
|
||||
# http://www.fltk.org/str.php?L2599
|
||||
Patch9: fltk-1_v4.3.x-keyboard-x11.patch
|
||||
# http://www.fltk.org/str.php?L2636
|
||||
Patch10: fltk-1.3.x-r9671-clipboard.patch
|
||||
Patch11: http://www.fltk.org/strfiles/2636/fltk-1_v6.3.x-clipboard-x11.patch
|
||||
# http://www.fltk.org/str.php?L2660
|
||||
Patch13: fltk-1.3.x-r9671-cursor.patch
|
||||
Patch20: fltk-1_v4.3.x-cursor-abi.patch
|
||||
# http://www.fltk.org/str.php?L2659
|
||||
Patch15: http://www.fltk.org/strfiles/2659/pixmap_v2.patch
|
||||
# http://www.fltk.org/str.php?L2802
|
||||
Patch16: fltk-1.3.x-r9671-modal.patch
|
||||
# http://www.fltk.org/str.php?L2816
|
||||
Patch17: http://www.fltk.org/strfiles/2816/fltk-1_v3.3.0-icons.patch
|
||||
# http://www.fltk.org/str.php?L2860
|
||||
Patch18: fltk-1.3.x-screen_num.patch
|
||||
Patch19: http://www.fltk.org/strfiles/2860/fltk-1_v3.3.x-multihead.patch
|
||||
Patch2: fltk-1.1.8-fluid_desktop.patch
|
||||
Patch3: fltk-1.3.3-lib-prefix.patch
|
||||
Patch4: fltk-1.3.3-man-install-dir.patch
|
||||
Patch5: fltk-1.3.3-install-fltk-config.patch
|
||||
Patch6: fltk-1.3.3-do-not-use-internal-ABI.patch
|
||||
Patch7: fltk-1.3.3-cmake35.patch
|
||||
BuildRequires: cmake
|
||||
BuildRequires: man
|
||||
BuildRequires: jpeg-devel
|
||||
BuildRequires: pkgconfig(cairo)
|
||||
#BuildRequires: pkgconfig(cairo)
|
||||
BuildRequires: pkgconfig(gl)
|
||||
BuildRequires: pkgconfig(fontconfig)
|
||||
BuildRequires: pkgconfig(libpng)
|
||||
|
@ -74,8 +59,8 @@ small group of developers across the world with a central
|
|||
repository in the US.
|
||||
|
||||
%files -n %{libname}
|
||||
%{_libdir}/libfltk.so.%{soname}
|
||||
%{_libdir}/libfltk.so.%{major}
|
||||
%{_libdir}/libfltk.so.%{version}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
@ -89,8 +74,8 @@ Conflicts: %{name} < 1.3.2
|
|||
This package contains a shared library for %{name}.
|
||||
|
||||
%files -n %{libforms}
|
||||
%{_libdir}/libfltk_forms.so.%{soname}
|
||||
%{_libdir}/libfltk_forms.so.%{major}
|
||||
%{_libdir}/libfltk_forms.so.%{version}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
@ -104,8 +89,8 @@ Conflicts: %{name} < 1.3.2
|
|||
This package contains a shared library for %{name}.
|
||||
|
||||
%files -n %{libgl}
|
||||
%{_libdir}/libfltk_gl.so.%{soname}
|
||||
%{_libdir}/libfltk_gl.so.%{major}
|
||||
%{_libdir}/libfltk_gl.so.%{version}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
@ -119,8 +104,8 @@ Conflicts: %{name} < 1.3.2
|
|||
This package contains a shared library for %{name}.
|
||||
|
||||
%files -n %{libimages}
|
||||
%{_libdir}/libfltk_images.so.%{soname}
|
||||
%{_libdir}/libfltk_images.so.%{major}
|
||||
%{_libdir}/libfltk_images.so.%{version}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
@ -147,8 +132,8 @@ linked applications.
|
|||
%{_mandir}/man?/*
|
||||
%{_libdir}/libfltk*.so
|
||||
%{_libdir}/libfltk*.a
|
||||
%dir %{_libdir}/FLTK-%{major}
|
||||
%{_libdir}/FLTK-%{major}/*
|
||||
%dir %{_libdir}/fltk
|
||||
%{_libdir}/fltk/*
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
@ -161,12 +146,10 @@ linked applications.
|
|||
export LDFLAGS="$LDFLAGS -lXfixes"
|
||||
%cmake \
|
||||
-DOPTION_BUILD_SHARED_LIBS=ON \
|
||||
-DOPTION_CAIRO=ON \
|
||||
-DOPTION_CAIROEXT=ON \
|
||||
-DOPTION_PREFIX_MAN=%{_mandir} \
|
||||
-DOPTION_PREFIX_LIB=%{_libdir} \
|
||||
-DOPTION_BUILD_EXAMPLES=OFF \
|
||||
-DOPTION_PREFIX_CONFIG=%{_libdir}/FLTK-%{major} \
|
||||
-DOPTION_PREFIX_CONFIG=%{_libdir}/FLTK-%{api} \
|
||||
-DFLTK_USE_SYSTEM_ZLIB=ON \
|
||||
-DFLTK_USE_SYSTEM_JPEG=ON \
|
||||
-DFLTK_USE_SYSTEM_PNG=ON \
|
||||
|
|
554
pixmap_v2.patch
554
pixmap_v2.patch
|
@ -1,554 +0,0 @@
|
|||
diff -ur fltk-1.3.2.org/FL/Fl_Image.H fltk-1.3.2/FL/Fl_Image.H
|
||||
--- fltk-1.3.2.org/FL/Fl_Image.H 2012-11-09 17:02:08.000000000 +0100
|
||||
+++ fltk-1.3.2/FL/Fl_Image.H 2013-01-16 14:40:51.543230638 +0100
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
class Fl_Widget;
|
||||
+class Fl_Pixmap;
|
||||
struct Fl_Menu_Item;
|
||||
struct Fl_Label;
|
||||
|
||||
@@ -203,6 +204,7 @@
|
||||
*/
|
||||
Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) :
|
||||
Fl_Image(W,H,D), array(bits), alloc_array(0), id_(0), mask_(0) {data((const char **)&array, 1); ld(LD);}
|
||||
+ Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg=FL_GRAY);
|
||||
virtual ~Fl_RGB_Image();
|
||||
virtual Fl_Image *copy(int W, int H);
|
||||
Fl_Image *copy() { return copy(w(), h()); }
|
||||
diff -ur fltk-1.3.2.org/src/fl_draw_pixmap.cxx fltk-1.3.2/src/fl_draw_pixmap.cxx
|
||||
--- fltk-1.3.2.org/src/fl_draw_pixmap.cxx 2012-04-22 05:09:31.000000000 +0200
|
||||
+++ fltk-1.3.2/src/fl_draw_pixmap.cxx 2013-01-16 14:40:51.542230588 +0100
|
||||
@@ -58,99 +58,6 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
-#ifdef U64
|
||||
-
|
||||
-// The callback from fl_draw_image to get a row of data passes this:
|
||||
-struct pixmap_data {
|
||||
- int w, h;
|
||||
- const uchar*const* data;
|
||||
- union {
|
||||
- U64 colors[256];
|
||||
- U64* byte1[256];
|
||||
- };
|
||||
-};
|
||||
-
|
||||
-// callback for 1 byte per pixel:
|
||||
-static void cb1(void*v, int x, int y, int w, uchar* buf) {
|
||||
- pixmap_data& d = *(pixmap_data*)v;
|
||||
- const uchar* p = d.data[y]+x;
|
||||
- U64* q = (U64*)buf;
|
||||
- for (int X=w; X>0; X-=2, p += 2) {
|
||||
- if (X>1) {
|
||||
-# if WORDS_BIGENDIAN
|
||||
- *q++ = (d.colors[p[0]]<<32) | d.colors[p[1]];
|
||||
-# else
|
||||
- *q++ = (d.colors[p[1]]<<32) | d.colors[p[0]];
|
||||
-# endif
|
||||
- } else {
|
||||
-# if WORDS_BIGENDIAN
|
||||
- *q++ = d.colors[p[0]]<<32;
|
||||
-# else
|
||||
- *q++ = d.colors[p[0]];
|
||||
-# endif
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-// callback for 2 bytes per pixel:
|
||||
-static void cb2(void*v, int x, int y, int w, uchar* buf) {
|
||||
- pixmap_data& d = *(pixmap_data*)v;
|
||||
- const uchar* p = d.data[y]+2*x;
|
||||
- U64* q = (U64*)buf;
|
||||
- for (int X=w; X>0; X-=2) {
|
||||
- U64* colors = d.byte1[*p++];
|
||||
- int index = *p++;
|
||||
- if (X>1) {
|
||||
- U64* colors1 = d.byte1[*p++];
|
||||
- int index1 = *p++;
|
||||
-# if WORDS_BIGENDIAN
|
||||
- *q++ = (colors[index]<<32) | colors1[index1];
|
||||
-# else
|
||||
- *q++ = (colors1[index1]<<32) | colors[index];
|
||||
-# endif
|
||||
- } else {
|
||||
-# if WORDS_BIGENDIAN
|
||||
- *q++ = colors[index]<<32;
|
||||
-# else
|
||||
- *q++ = colors[index];
|
||||
-# endif
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-#else // U32
|
||||
-
|
||||
-// The callback from fl_draw_image to get a row of data passes this:
|
||||
-struct pixmap_data {
|
||||
- int w, h;
|
||||
- const uchar*const* data;
|
||||
- union {
|
||||
- U32 colors[256];
|
||||
- U32* byte1[256];
|
||||
- };
|
||||
-};
|
||||
-
|
||||
-// callback for 1 byte per pixel:
|
||||
-static void cb1(void*v, int x, int y, int w, uchar* buf) {
|
||||
- pixmap_data& d = *(pixmap_data*)v;
|
||||
- const uchar* p = d.data[y]+x;
|
||||
- U32* q = (U32*)buf;
|
||||
- for (int X=w; X--;) *q++ = d.colors[*p++];
|
||||
-}
|
||||
-
|
||||
-// callback for 2 bytes per pixel:
|
||||
-static void cb2(void*v, int x, int y, int w, uchar* buf) {
|
||||
- pixmap_data& d = *(pixmap_data*)v;
|
||||
- const uchar* p = d.data[y]+2*x;
|
||||
- U32* q = (U32*)buf;
|
||||
- for (int X=w; X--;) {
|
||||
- U32* colors = d.byte1[*p++];
|
||||
- *q++ = colors[*p++];
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-#endif // U64 else U32
|
||||
-
|
||||
uchar **fl_mask_bitmap; // if non-zero, create bitmap and store pointer here
|
||||
|
||||
/**
|
||||
@@ -200,34 +107,33 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
-/**
|
||||
- Draw XPM image data, with the top-left corner at the given position.
|
||||
- \see fl_draw_pixmap(char* const* data, int x, int y, Fl_Color bg)
|
||||
- */
|
||||
-int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) {
|
||||
- pixmap_data d;
|
||||
- if (!fl_measure_pixmap(cdata, d.w, d.h)) return 0;
|
||||
+int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg) {
|
||||
+ int w, h;
|
||||
const uchar*const* data = (const uchar*const*)(cdata+1);
|
||||
int transparent_index = -1;
|
||||
+
|
||||
+ if (!fl_measure_pixmap(cdata, w, h))
|
||||
+ return 0;
|
||||
+
|
||||
+ if ((chars_per_pixel < 1) || (chars_per_pixel > 2))
|
||||
+ return 0;
|
||||
+
|
||||
+ uchar colors[1<<(chars_per_pixel*8)][4];
|
||||
+
|
||||
#ifdef WIN32
|
||||
uchar *transparent_c = (uchar *)0; // such that transparent_c[0,1,2] are the RGB of the transparent color
|
||||
color_count = 0;
|
||||
used_colors = (uchar *)malloc(abs(ncolors)*3*sizeof(uchar));
|
||||
#endif
|
||||
|
||||
- if (ncolors < 0) { // FLTK (non standard) compressed colormap
|
||||
+ if (ncolors < 0) {
|
||||
+ // FLTK (non standard) compressed colormap
|
||||
ncolors = -ncolors;
|
||||
const uchar *p = *data++;
|
||||
// if first color is ' ' it is transparent (put it later to make
|
||||
// it not be transparent):
|
||||
if (*p == ' ') {
|
||||
- uchar* c = (uchar*)&d.colors[(int)' '];
|
||||
-#ifdef U64
|
||||
- *(U64*)c = 0;
|
||||
-# if WORDS_BIGENDIAN
|
||||
- c += 4;
|
||||
-# endif
|
||||
-#endif
|
||||
+ uchar* c = colors[(int)' '];
|
||||
transparent_index = ' ';
|
||||
Fl::get_color(bg, c[0], c[1], c[2]); c[3] = 0;
|
||||
#ifdef WIN32
|
||||
@@ -238,13 +144,7 @@
|
||||
}
|
||||
// read all the rest of the colors:
|
||||
for (int i=0; i < ncolors; i++) {
|
||||
- uchar* c = (uchar*)&d.colors[*p++];
|
||||
-#ifdef U64
|
||||
- *(U64*)c = 0;
|
||||
-# if WORDS_BIGENDIAN
|
||||
- c += 4;
|
||||
-# endif
|
||||
-#endif
|
||||
+ uchar* c = colors[*p++];
|
||||
#ifdef WIN32
|
||||
used_colors[3*color_count] = *p;
|
||||
used_colors[3*color_count+1] = *(p+1);
|
||||
@@ -254,69 +154,44 @@
|
||||
*c++ = *p++;
|
||||
*c++ = *p++;
|
||||
*c++ = *p++;
|
||||
-#ifdef __APPLE_QUARTZ__
|
||||
*c = 255;
|
||||
-#else
|
||||
- *c = 0;
|
||||
-#endif
|
||||
}
|
||||
- } else { // normal XPM colormap with names
|
||||
- if (chars_per_pixel>1) memset(d.byte1, 0, sizeof(d.byte1));
|
||||
+ } else {
|
||||
+ // normal XPM colormap with names
|
||||
for (int i=0; i<ncolors; i++) {
|
||||
const uchar *p = *data++;
|
||||
// the first 1 or 2 characters are the color index:
|
||||
int ind = *p++;
|
||||
uchar* c;
|
||||
- if (chars_per_pixel>1) {
|
||||
-#ifdef U64
|
||||
- U64* colors = d.byte1[ind];
|
||||
- if (!colors) colors = d.byte1[ind] = new U64[256];
|
||||
-#else
|
||||
- U32* colors = d.byte1[ind];
|
||||
- if (!colors) colors = d.byte1[ind] = new U32[256];
|
||||
-#endif
|
||||
- c = (uchar*)&colors[*p];
|
||||
- ind = (ind<<8)|*p++;
|
||||
- } else {
|
||||
- c = (uchar *)&d.colors[ind];
|
||||
- }
|
||||
+ if (chars_per_pixel>1)
|
||||
+ ind = (ind<<8)|*p++;
|
||||
+ c = colors[ind];
|
||||
// look for "c word", or last word if none:
|
||||
const uchar *previous_word = p;
|
||||
for (;;) {
|
||||
- while (*p && isspace(*p)) p++;
|
||||
- uchar what = *p++;
|
||||
- while (*p && !isspace(*p)) p++;
|
||||
- while (*p && isspace(*p)) p++;
|
||||
- if (!*p) {p = previous_word; break;}
|
||||
- if (what == 'c') break;
|
||||
- previous_word = p;
|
||||
- while (*p && !isspace(*p)) p++;
|
||||
+ while (*p && isspace(*p)) p++;
|
||||
+ uchar what = *p++;
|
||||
+ while (*p && !isspace(*p)) p++;
|
||||
+ while (*p && isspace(*p)) p++;
|
||||
+ if (!*p) {p = previous_word; break;}
|
||||
+ if (what == 'c') break;
|
||||
+ previous_word = p;
|
||||
+ while (*p && !isspace(*p)) p++;
|
||||
}
|
||||
-#ifdef U64
|
||||
- *(U64*)c = 0;
|
||||
-# if WORDS_BIGENDIAN
|
||||
- c += 4;
|
||||
-# endif
|
||||
-#endif
|
||||
-#ifdef __APPLE_QUARTZ__
|
||||
- c[3] = 255;
|
||||
-#endif
|
||||
int parse = fl_parse_color((const char*)p, c[0], c[1], c[2]);
|
||||
+ c[3] = 255;
|
||||
if (parse) {
|
||||
#ifdef WIN32
|
||||
- used_colors[3*color_count] = c[0];
|
||||
- used_colors[3*color_count+1] = c[1];
|
||||
- used_colors[3*color_count+2] = c[2];
|
||||
- color_count++;
|
||||
+ used_colors[3*color_count] = c[0];
|
||||
+ used_colors[3*color_count+1] = c[1];
|
||||
+ used_colors[3*color_count+2] = c[2];
|
||||
+ color_count++;
|
||||
#endif
|
||||
- }
|
||||
- else {
|
||||
+ } else {
|
||||
// assume "None" or "#transparent" for any errors
|
||||
- // "bg" should be transparent...
|
||||
- Fl::get_color(bg, c[0], c[1], c[2]);
|
||||
-#ifdef __APPLE_QUARTZ__
|
||||
+ // "bg" should be transparent...
|
||||
+ Fl::get_color(bg, c[0], c[1], c[2]);
|
||||
c[3] = 0;
|
||||
-#endif
|
||||
transparent_index = ind;
|
||||
#ifdef WIN32
|
||||
transparent_c = c;
|
||||
@@ -324,7 +199,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
- d.data = data;
|
||||
#ifdef WIN32
|
||||
if (transparent_c) {
|
||||
make_unused_color(transparent_c[0], transparent_c[1], transparent_c[2]);
|
||||
@@ -334,77 +208,76 @@
|
||||
make_unused_color(r, g, b);
|
||||
}
|
||||
#endif
|
||||
+
|
||||
+ U32 *q = (U32*)out;
|
||||
+ for (int Y = 0; Y < h; Y++) {
|
||||
+ const uchar* p = data[Y];
|
||||
+ if (chars_per_pixel <= 1) {
|
||||
+ for (int X = 0; X < w; X++)
|
||||
+ memcpy(q++, colors[*p++], 4);
|
||||
+ } else {
|
||||
+ for (int X = 0; X < w; X++) {
|
||||
+ int ind = (*p++)<<8;
|
||||
+ ind |= *p++;
|
||||
+ memcpy(q++, colors[ind], 4);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ Draw XPM image data, with the top-left corner at the given position.
|
||||
+ \see fl_draw_pixmap(char* const* data, int x, int y, Fl_Color bg)
|
||||
+ */
|
||||
+int fl_draw_pixmap(const char*const* cdata, int x, int y, Fl_Color bg) {
|
||||
+ int w, h;
|
||||
+
|
||||
+ if (!fl_measure_pixmap(cdata, w, h))
|
||||
+ return 0;
|
||||
+
|
||||
+ uchar buffer[w*h*4];
|
||||
+
|
||||
+ if (!fl_convert_pixmap(cdata, buffer, bg))
|
||||
+ return 0;
|
||||
+
|
||||
+ // FIXME: Hack until fl_draw_image() supports alpha properly
|
||||
#ifdef __APPLE_QUARTZ__
|
||||
if (Fl_Surface_Device::surface() == Fl_Display_Device::display_device()) {
|
||||
- U32 *array = new U32[d.w * d.h], *q = array;
|
||||
- for (int Y = 0; Y < d.h; Y++) {
|
||||
- const uchar* p = data[Y];
|
||||
- if (chars_per_pixel <= 1) {
|
||||
- for (int X = 0; X < d.w; X++) {
|
||||
- *q++ = d.colors[*p++];
|
||||
- }
|
||||
- } else {
|
||||
- for (int X = 0; X < d.w; X++) {
|
||||
- U32* colors = (U32*)d.byte1[*p++];
|
||||
- *q++ = colors[*p++];
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- Fl_RGB_Image* rgb = new Fl_RGB_Image((uchar*)array, d.w, d.h, 4);
|
||||
+ Fl_RGB_Image* rgb = new Fl_RGB_Image(buffer, w, h, 4);
|
||||
rgb->draw(x, y);
|
||||
delete rgb;
|
||||
- delete[] array;
|
||||
- }
|
||||
- else {
|
||||
+ } else {
|
||||
#endif // __APPLE_QUARTZ__
|
||||
-
|
||||
// build the mask bitmap used by Fl_Pixmap:
|
||||
- if (fl_mask_bitmap && transparent_index >= 0) {
|
||||
- int W = (d.w+7)/8;
|
||||
- uchar* bitmap = new uchar[W * d.h];
|
||||
+ if (fl_mask_bitmap) {
|
||||
+ int W = (w+7)/8;
|
||||
+ uchar* bitmap = new uchar[W * h];
|
||||
*fl_mask_bitmap = bitmap;
|
||||
- for (int Y = 0; Y < d.h; Y++) {
|
||||
- const uchar* p = data[Y];
|
||||
- if (chars_per_pixel <= 1) {
|
||||
- int dw = d.w;
|
||||
- for (int X = 0; X < W; X++) {
|
||||
- uchar b = (dw-->0 && *p++ != transparent_index);
|
||||
- if (dw-->0 && *p++ != transparent_index) b |= 2;
|
||||
- if (dw-->0 && *p++ != transparent_index) b |= 4;
|
||||
- if (dw-->0 && *p++ != transparent_index) b |= 8;
|
||||
- if (dw-->0 && *p++ != transparent_index) b |= 16;
|
||||
- if (dw-->0 && *p++ != transparent_index) b |= 32;
|
||||
- if (dw-->0 && *p++ != transparent_index) b |= 64;
|
||||
- if (dw-->0 && *p++ != transparent_index) b |= 128;
|
||||
+ const uchar *p = &buffer[3];
|
||||
+ uchar b = 0;
|
||||
+ for (int Y = 0; Y < h; Y++) {
|
||||
+ b = 0;
|
||||
+ for (int X = 0, bit = 1; X < w; X++, p += 4) {
|
||||
+ if (*p > 127) b |= bit;
|
||||
+ bit <<= 1;
|
||||
+ if (bit > 0x80 || X == w-1) {
|
||||
*bitmap++ = b;
|
||||
- }
|
||||
- } else {
|
||||
- uchar b = 0, bit = 1;
|
||||
- for (int X = 0; X < d.w; X++) {
|
||||
- int ind = *p++;
|
||||
- ind = (ind<<8) | (*p++);
|
||||
- if (ind != transparent_index) b |= bit;
|
||||
-
|
||||
- if (bit < 128) bit <<= 1;
|
||||
- else {
|
||||
- *bitmap++ = b;
|
||||
- b = 0;
|
||||
- bit = 1;
|
||||
+ bit = 1;
|
||||
+ b = 0;
|
||||
}
|
||||
}
|
||||
-
|
||||
- if (bit > 1) *bitmap++ = b;
|
||||
}
|
||||
- }
|
||||
+
|
||||
}
|
||||
|
||||
- fl_draw_image(chars_per_pixel==1 ? cb1 : cb2, &d, x, y, d.w, d.h, 4);
|
||||
+ fl_draw_image(buffer, x, y, w, h, 4);
|
||||
+
|
||||
#ifdef __APPLE_QUARTZ__
|
||||
}
|
||||
#endif
|
||||
|
||||
- if (chars_per_pixel > 1) for (int i = 0; i < 256; i++) delete[] d.byte1[i];
|
||||
return 1;
|
||||
}
|
||||
|
||||
diff -ur fltk-1.3.2.org/src/Fl_Image.cxx fltk-1.3.2/src/Fl_Image.cxx
|
||||
--- fltk-1.3.2.org/src/Fl_Image.cxx 2012-11-09 17:02:08.000000000 +0100
|
||||
+++ fltk-1.3.2/src/Fl_Image.cxx 2013-01-16 14:41:38.404162795 +0100
|
||||
@@ -165,7 +165,22 @@
|
||||
//
|
||||
size_t Fl_RGB_Image::max_size_ = ~((size_t)0);
|
||||
|
||||
-/** The destructor free all memory and server resources that are used by the image. */
|
||||
+int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg);
|
||||
+
|
||||
+/** The constructor creates a new RGBA image from the specified Fl_Pixmap.
|
||||
+
|
||||
+ The RGBA image is built fully opaque except for the transparent area
|
||||
+ of the pixmap that is assigned the \par bg color with full transparency */
|
||||
+Fl_RGB_Image::Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg):
|
||||
+ Fl_Image(pxm->w(), pxm->h(), 4), id_(0), mask_(0)
|
||||
+{
|
||||
+ array = new uchar[w() * h() * d()];
|
||||
+ alloc_array = 1;
|
||||
+ fl_convert_pixmap(pxm->data(), (uchar*)array, bg);
|
||||
+ data((const char **)&array, 1);
|
||||
+}
|
||||
+
|
||||
+/** The destructor frees all memory and server resources that are used by the image. */
|
||||
Fl_RGB_Image::~Fl_RGB_Image() {
|
||||
uncache();
|
||||
if (alloc_array) delete[] (uchar *)array;
|
||||
diff -ur fltk-1.3.2.org/src/ps_image.cxx fltk-1.3.2/src/ps_image.cxx
|
||||
--- fltk-1.3.2.org/src/ps_image.cxx 2011-07-19 06:49:30.000000000 +0200
|
||||
+++ fltk-1.3.2/src/ps_image.cxx 2013-01-16 14:40:51.541228080 +0100
|
||||
@@ -185,72 +185,38 @@
|
||||
|
||||
extern uchar **fl_mask_bitmap;
|
||||
|
||||
+struct callback_data {
|
||||
+ const uchar *data;
|
||||
+ int D, LD;
|
||||
+};
|
||||
|
||||
-void Fl_PostScript_Graphics_Driver::draw_image(const uchar *data, int ix, int iy, int iw, int ih, int D, int LD) {
|
||||
- double x = ix, y = iy, w = iw, h = ih;
|
||||
|
||||
- if (D<3){ //mono
|
||||
- draw_image_mono(data, ix, iy, iw, ih, D, LD);
|
||||
- return;
|
||||
- }
|
||||
+static void draw_image_cb(void *data, int x, int y, int w, uchar *buf) {
|
||||
+ struct callback_data *cb_data;
|
||||
+ const uchar *curdata;
|
||||
|
||||
+ cb_data = (struct callback_data*)data;
|
||||
+ curdata = cb_data->data + x*cb_data->D + y*cb_data->LD;
|
||||
|
||||
- int i,j, k;
|
||||
+ memcpy(buf, curdata, w*cb_data->D);
|
||||
+}
|
||||
|
||||
- fprintf(output,"save\n");
|
||||
|
||||
- const char * interpol;
|
||||
- if (lang_level_>1){
|
||||
- if (interpolate_)
|
||||
- interpol="true";
|
||||
- else
|
||||
- interpol="false";
|
||||
- if (mask && lang_level_>2)
|
||||
- fprintf(output, "%g %g %g %g %i %i %i %i %s CIM\n", x , y+h , w , -h , iw , ih, mx, my, interpol);
|
||||
- else
|
||||
- fprintf(output, "%g %g %g %g %i %i %s CII\n", x , y+h , w , -h , iw , ih, interpol);
|
||||
- } else
|
||||
- fprintf(output , "%g %g %g %g %i %i CI", x , y+h , w , -h , iw , ih);
|
||||
+void Fl_PostScript_Graphics_Driver::draw_image(const uchar *data, int ix, int iy, int iw, int ih, int D, int LD) {
|
||||
+ if (D<3){ //mono
|
||||
+ draw_image_mono(data, ix, iy, iw, ih, D, LD);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
+ struct callback_data cb_data;
|
||||
|
||||
if (!LD) LD = iw*D;
|
||||
- uchar *curmask=mask;
|
||||
-
|
||||
- for (j=0; j<ih;j++){
|
||||
- if (mask){
|
||||
-
|
||||
- for (k=0;k<my/ih;k++){
|
||||
- for (i=0; i<((mx+7)/8);i++){
|
||||
- if (!(i%80)) fprintf(output, "\n");
|
||||
- fprintf(output, "%.2x",swap_byte(*curmask));
|
||||
- curmask++;
|
||||
- }
|
||||
- fprintf(output,"\n");
|
||||
- }
|
||||
- }
|
||||
- const uchar *curdata=data+j*LD;
|
||||
- for (i=0 ; i<iw ; i++) {
|
||||
- uchar r = curdata[0];
|
||||
- uchar g = curdata[1];
|
||||
- uchar b = curdata[2];
|
||||
- if (lang_level_<3 && D>3) { //can do mixing using bg_* colors)
|
||||
- unsigned int a2 = curdata[3]; //must be int
|
||||
- unsigned int a = 255-a2;
|
||||
- r = (a2 * r + bg_r * a)/255;
|
||||
- g = (a2 * g + bg_g * a)/255;
|
||||
- b = (a2 * b + bg_b * a)/255;
|
||||
- }
|
||||
- if (!(i%40)) fprintf(output, "\n");
|
||||
- fprintf(output, "%.2x%.2x%.2x", r, g, b);
|
||||
- curdata +=D;
|
||||
- }
|
||||
- fprintf(output,"\n");
|
||||
-
|
||||
- }
|
||||
-
|
||||
- fprintf(output," >\nrestore\n" );
|
||||
|
||||
+ cb_data.data = data;
|
||||
+ cb_data.D = D;
|
||||
+ cb_data.LD = LD;
|
||||
|
||||
+ draw_image(draw_image_cb, &cb_data, ix, iy, iw, ih, D);
|
||||
}
|
||||
|
||||
void Fl_PostScript_Graphics_Driver::draw_image(Fl_Draw_Image_Cb call, void *data, int ix, int iy, int iw, int ih, int D) {
|
||||
@@ -325,6 +291,14 @@
|
||||
uchar g = curdata[1];
|
||||
uchar b = curdata[2];
|
||||
|
||||
+ if (lang_level_<3 && D>3) { //can do mixing using bg_* colors)
|
||||
+ unsigned int a2 = curdata[3]; //must be int
|
||||
+ unsigned int a = 255-a2;
|
||||
+ r = (a2 * r + bg_r * a)/255;
|
||||
+ g = (a2 * g + bg_g * a)/255;
|
||||
+ b = (a2 * b + bg_b * a)/255;
|
||||
+ }
|
||||
+
|
||||
if (!(i%40)) fputs("\n", output);
|
||||
fprintf(output, "%.2x%.2x%.2x", r, g, b);
|
||||
|
Loading…
Add table
Reference in a new issue