fltk-1.3.2

This commit is contained in:
Rex Dieter 2013-08-26 19:42:53 -05:00
parent e2c100c3c6
commit 23b0642d41
14 changed files with 2956 additions and 310 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
/fltk-1.1.10-source.tar.bz2
/fltk-1.3.0-source.tar.gz
/fltk-1.3.x-r9671.tar.bz2
/fltk-1.3.2-source.tar.gz

View File

@ -1,7 +1,7 @@
diff -up fltk-1.3.x-r8659/src/Fl_x.cxx.orig fltk-1.3.x-r8659/src/Fl_x.cxx
--- fltk-1.3.x-r8659/src/Fl_x.cxx.orig 2011-05-17 16:37:11.092011814 +0200
+++ fltk-1.3.x-r8659/src/Fl_x.cxx 2011-05-18 13:51:06.135475325 +0200
@@ -309,6 +309,9 @@ static Atom WM_PROTOCOLS;
diff -up fltk-1.3.x-r9671/src/Fl_x.cxx.clipboard-x11 fltk-1.3.x-r9671/src/Fl_x.cxx
--- fltk-1.3.x-r9671/src/Fl_x.cxx.clipboard-x11 2013-08-21 15:34:03.445627071 -0500
+++ fltk-1.3.x-r9671/src/Fl_x.cxx 2013-08-21 15:34:03.455626970 -0500
@@ -307,6 +307,9 @@ static Atom WM_PROTOCOLS;
static Atom fl_MOTIF_WM_HINTS;
static Atom TARGETS;
static Atom CLIPBOARD;
@ -11,7 +11,7 @@ diff -up fltk-1.3.x-r8659/src/Fl_x.cxx.orig fltk-1.3.x-r8659/src/Fl_x.cxx
Atom fl_XdndAware;
Atom fl_XdndSelection;
Atom fl_XdndEnter;
@@ -678,6 +681,9 @@ void fl_open_display(Display* d) {
@@ -667,6 +670,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);
@ -21,7 +21,7 @@ diff -up fltk-1.3.x-r8659/src/Fl_x.cxx.orig fltk-1.3.x-r8659/src/Fl_x.cxx
fl_XdndAware = XInternAtom(d, "XdndAware", 0);
fl_XdndSelection = XInternAtom(d, "XdndSelection", 0);
fl_XdndEnter = XInternAtom(d, "XdndEnter", 0);
@@ -861,6 +881,86 @@ void Fl::copy(const char *stuff, int len
@@ -900,6 +906,86 @@ void Fl::copy(const char *stuff, int len
}
////////////////////////////////////////////////////////////////
@ -108,7 +108,7 @@ diff -up fltk-1.3.x-r8659/src/Fl_x.cxx.orig fltk-1.3.x-r8659/src/Fl_x.cxx
const XEvent* fl_xevent; // the current x event
ulong fl_event_time; // the last timestamp from an x event
@@ -976,7 +1102,6 @@ int fl_handle(const XEvent& thisevent)
@@ -1023,7 +1109,6 @@ int fl_handle(const XEvent& thisevent)
return 0;
case SelectionNotify: {
@ -116,7 +116,7 @@ diff -up fltk-1.3.x-r8659/src/Fl_x.cxx.orig fltk-1.3.x-r8659/src/Fl_x.cxx
static unsigned char* buffer = 0;
if (buffer) {XFree(buffer); buffer = 0;}
long bytesread = 0;
@@ -992,6 +1117,19 @@ int fl_handle(const XEvent& thisevent)
@@ -1039,6 +1124,19 @@ int fl_handle(const XEvent& thisevent)
bytesread/4, 65536, 1, 0,
&actual, &format, &count, &remaining,
&portion)) break; // quit on error
@ -136,7 +136,7 @@ diff -up fltk-1.3.x-r8659/src/Fl_x.cxx.orig fltk-1.3.x-r8659/src/Fl_x.cxx
if (actual == TARGETS || actual == XA_ATOM) {
Atom type = XA_STRING;
for (unsigned i = 0; i<count; i++) {
@@ -1029,6 +1167,9 @@ int fl_handle(const XEvent& thisevent)
@@ -1075,6 +1173,9 @@ int fl_handle(const XEvent& thisevent)
buffer[bytesread] = 0;
convert_crlf(buffer, bytesread);
}
@ -146,7 +146,7 @@ diff -up fltk-1.3.x-r8659/src/Fl_x.cxx.orig fltk-1.3.x-r8659/src/Fl_x.cxx
Fl::e_text = buffer ? (char*)buffer : (char *)"";
Fl::e_length = bytesread;
int old_event = Fl::e_number;
@@ -1049,6 +1190,7 @@ int fl_handle(const XEvent& thisevent)
@@ -1095,6 +1196,7 @@ int fl_handle(const XEvent& thisevent)
case SelectionClear: {
int clipboard = fl_xevent->xselectionclear.selection == CLIPBOARD;
fl_i_own_selection[clipboard] = 0;
@ -154,7 +154,7 @@ diff -up fltk-1.3.x-r8659/src/Fl_x.cxx.orig fltk-1.3.x-r8659/src/Fl_x.cxx
return 1;}
case SelectionRequest: {
@@ -1248,6 +1390,9 @@ int fl_handle(const XEvent& thisevent)
@@ -1307,6 +1409,9 @@ int fl_handle(const XEvent& thisevent)
case FocusIn:
if (fl_xim_ic) XSetICFocus(fl_xim_ic);
event = FL_FOCUS;

View File

@ -1,6 +1,6 @@
diff -ur fltk-1.3.0r9619.org/configh.in fltk-1.3.0r9619/configh.in
--- fltk-1.3.0r9619.org/configh.in 2011-10-04 11:21:47.000000000 +0200
+++ fltk-1.3.0r9619/configh.in 2012-06-18 16:14:05.012277003 +0200
diff -up fltk-1.3.x-r9671/configh.in.clipboard-xfixes fltk-1.3.x-r9671/configh.in
--- fltk-1.3.x-r9671/configh.in.clipboard-xfixes 2011-10-04 04:21:47.000000000 -0500
+++ fltk-1.3.x-r9671/configh.in 2013-08-21 15:35:08.441966345 -0500
@@ -108,6 +108,14 @@
#define USE_XDBE HAVE_XDBE
@ -16,10 +16,10 @@ diff -ur fltk-1.3.0r9619.org/configh.in fltk-1.3.0r9619/configh.in
* __APPLE_QUARTZ__:
*
* All Apple implementations are now based on Quartz and Cocoa,
diff -ur fltk-1.3.0r9619.org/configure.in fltk-1.3.0r9619/configure.in
--- fltk-1.3.0r9619.org/configure.in 2012-06-18 16:13:38.744017220 +0200
+++ fltk-1.3.0r9619/configure.in 2012-06-18 16:14:05.013277050 +0200
@@ -999,6 +999,16 @@
diff -up fltk-1.3.x-r9671/configure.in.clipboard-xfixes fltk-1.3.x-r9671/configure.in
--- fltk-1.3.x-r9671/configure.in.clipboard-xfixes 2012-04-21 21:45:09.000000000 -0500
+++ fltk-1.3.x-r9671/configure.in 2013-08-21 15:35:08.442966335 -0500
@@ -997,6 +997,16 @@ case $uname_GUI in
LIBS="-lXext $LIBS")
fi
@ -36,10 +36,10 @@ diff -ur fltk-1.3.0r9619.org/configure.in fltk-1.3.0r9619/configure.in
dnl Check for overlay visuals...
AC_PATH_PROG(XPROP, xprop)
AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay,
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 16:13:38.749017460 +0200
+++ fltk-1.3.0r9619/src/Fl_x.cxx 2012-06-18 16:13:24.000000000 +0200
@@ -53,6 +53,12 @@
diff -up fltk-1.3.x-r9671/src/Fl_x.cxx.clipboard-xfixes fltk-1.3.x-r9671/src/Fl_x.cxx
--- fltk-1.3.x-r9671/src/Fl_x.cxx.clipboard-xfixes 2013-08-21 15:35:08.437966386 -0500
+++ fltk-1.3.x-r9671/src/Fl_x.cxx 2013-08-21 15:35:08.442966335 -0500
@@ -53,6 +53,12 @@ static XRRUpdateConfiguration_type XRRUp
static int randrEventBase; // base of RandR-defined events
#endif
@ -52,7 +52,7 @@ diff -ur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx
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
@@ -197,6 +203,14 @@
@@ -197,6 +203,14 @@ static void do_queued_events() {
Fl::handle(FL_MOVE, fl_xmousewin);
}
#endif
@ -67,7 +67,7 @@ diff -ur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx
}
// these pointers are set by the Fl::lock() function:
@@ -917,6 +931,10 @@
@@ -917,6 +931,10 @@ extern void fl_trigger_clipboard_notify(
static void poll_clipboard_owner(void) {
Window xid;
@ -78,7 +78,7 @@ diff -ur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx
// No one is interested, so no point polling
if (fl_clipboard_notify_empty())
return;
@@ -955,10 +973,12 @@
@@ -955,10 +973,12 @@ static void handle_clipboard_timestamp(i
timestamp = clipboard ? &clipboard_timestamp : &primary_timestamp;
@ -95,7 +95,7 @@ diff -ur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx
}
// Same selection
@@ -978,10 +998,12 @@
@@ -978,10 +998,12 @@ void fl_clipboard_notify_change() {
primary_timestamp = -1;
clipboard_timestamp = -1;
} else {
@ -111,7 +111,7 @@ diff -ur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx
}
}
@@ -1780,6 +1802,25 @@
@@ -1780,6 +1802,25 @@ int fl_handle(const XEvent& thisevent)
}
}
@ -137,7 +137,7 @@ diff -ur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx
return Fl::handle(event, window);
}
@@ -2100,6 +2141,16 @@
@@ -2100,6 +2141,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);
}

View File

@ -1,7 +1,7 @@
diff -up fltk-1.3.x-r8659/FL/Fl.H.orig fltk-1.3.x-r8659/FL/Fl.H
--- fltk-1.3.x-r8659/FL/Fl.H.orig 2011-05-17 16:25:56.671744548 +0200
+++ fltk-1.3.x-r8659/FL/Fl.H 2011-05-17 16:26:05.709101536 +0200
@@ -108,6 +108,9 @@ typedef int (*Fl_Args_Handler)(int argc,
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);
@ -11,7 +11,7 @@ diff -up fltk-1.3.x-r8659/FL/Fl.H.orig fltk-1.3.x-r8659/FL/Fl.H
/** @} */ /* group callback_functions */
@@ -744,6 +747,19 @@ public:
@@ -746,6 +749,19 @@ public:
*/
static void paste(Fl_Widget &receiver, int source /*=0*/); // platform dependent
/**
@ -31,10 +31,10 @@ diff -up fltk-1.3.x-r8659/FL/Fl.H.orig fltk-1.3.x-r8659/FL/Fl.H
Initiate a Drag And Drop operation. The selection buffer should be
filled with relevant data before calling this method. FLTK will
then initiate the system wide drag and drop handling. Dropped data
diff -up fltk-1.3.x-r8659/src/Fl.cxx.orig fltk-1.3.x-r8659/src/Fl.cxx
--- fltk-1.3.x-r8659/src/Fl.cxx.orig 2011-05-18 15:20:26.667291459 +0200
+++ fltk-1.3.x-r8659/src/Fl.cxx 2011-05-18 16:31:15.522026086 +0200
@@ -430,6 +430,69 @@ static char in_idle;
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
////////////////////////////////////////////////////////////////

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,645 @@
diff -up fltk-1.3.x-r9671/FL/Fl_Window.H.icons fltk-1.3.x-r9671/FL/Fl_Window.H
--- fltk-1.3.x-r9671/FL/Fl_Window.H.icons 2013-08-21 15:38:29.051910552 -0500
+++ fltk-1.3.x-r9671/FL/Fl_Window.H 2013-08-21 15:38:29.070910357 -0500
@@ -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 @@ class FL_EXPORT Fl_Window : public Fl_Gr
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 @@ protected:
*/
int force_position() const { return ((flags() & FORCE_POSITION)?1:0); }
+ void free_icons();
+
public:
/**
@@ -350,6 +366,18 @@ public:
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 -up fltk-1.3.x-r9671/FL/mac.H.icons fltk-1.3.x-r9671/FL/mac.H
--- fltk-1.3.x-r9671/FL/mac.H.icons 2013-08-21 15:38:29.041910655 -0500
+++ fltk-1.3.x-r9671/FL/mac.H 2013-08-21 15:38:29.070910357 -0500
@@ -120,6 +120,9 @@ public:
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 -up fltk-1.3.x-r9671/FL/win32.H.icons fltk-1.3.x-r9671/FL/win32.H
--- fltk-1.3.x-r9671/FL/win32.H.icons 2013-08-21 15:38:29.041910655 -0500
+++ fltk-1.3.x-r9671/FL/win32.H 2013-08-21 15:38:29.071910347 -0500
@@ -84,6 +84,9 @@ public:
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 -up fltk-1.3.x-r9671/FL/x.H.icons fltk-1.3.x-r9671/FL/x.H
--- fltk-1.3.x-r9671/FL/x.H.icons 2013-08-21 15:38:29.042910645 -0500
+++ fltk-1.3.x-r9671/FL/x.H 2013-08-21 15:38:29.071910347 -0500
@@ -154,6 +154,8 @@ public:
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 -up fltk-1.3.x-r9671/src/Fl.cxx.icons fltk-1.3.x-r9671/src/Fl.cxx
--- fltk-1.3.x-r9671/src/Fl.cxx.icons 2013-08-21 15:38:29.026910809 -0500
+++ fltk-1.3.x-r9671/src/Fl.cxx 2013-08-21 15:38:29.072910336 -0500
@@ -1531,6 +1531,8 @@ Fl_Window::~Fl_Window() {
if (xclass_) {
free(xclass_);
}
+ free_icons();
+ delete icon_;
}
// FL_SHOW and FL_HIDE are called whenever the visibility of this widget
diff -up fltk-1.3.x-r9671/src/Fl_win32.cxx.icons fltk-1.3.x-r9671/src/Fl_win32.cxx
--- fltk-1.3.x-r9671/src/Fl_win32.cxx.icons 2013-08-21 15:38:29.065910408 -0500
+++ fltk-1.3.x-r9671/src/Fl_win32.cxx 2013-08-21 15:38:29.073910326 -0500
@@ -1648,6 +1648,8 @@ Fl_X* Fl_X::make(Fl_Window* w) {
);
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
@@ -1876,71 +1878,19 @@ void Fl_Window::label(const char *name,c
////////////////////////////////////////////////////////////////
-#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));
@@ -1962,7 +1912,7 @@ int Fl_X::set_cursor(const Fl_RGB_Image
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++) {
@@ -1991,22 +1941,206 @@ int Fl_X::set_cursor(const Fl_RGB_Image
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 -up fltk-1.3.x-r9671/src/Fl_Window.cxx.icons fltk-1.3.x-r9671/src/Fl_Window.cxx
--- fltk-1.3.x-r9671/src/Fl_Window.cxx.icons 2013-08-21 15:38:29.046910603 -0500
+++ fltk-1.3.x-r9671/src/Fl_Window.cxx 2013-08-21 15:38:29.073910326 -0500
@@ -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 @@ void Fl_Window::_Fl_Window() {
}
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 @@ const char *Fl_Window::xclass() const
}
}
+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 9443 2012-05-05 13:36:47Z AlbrechtS $".
diff -up fltk-1.3.x-r9671/src/Fl_x.cxx.icons fltk-1.3.x-r9671/src/Fl_x.cxx
--- fltk-1.3.x-r9671/src/Fl_x.cxx.icons 2013-08-21 15:38:29.066910398 -0500
+++ fltk-1.3.x-r9671/src/Fl_x.cxx 2013-08-21 15:38:29.075910306 -0500
@@ -353,6 +353,7 @@ Atom fl_NET_SUPPORTING_WM_CHECK;
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,
@@ -717,6 +718,7 @@ void fl_open_display(Display* d) {
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;
@@ -2136,12 +2138,14 @@ void Fl_X::make_xid(Fl_Window* win, XVis
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)
@@ -2260,6 +2264,93 @@ void Fl_Window::size_range_() {
}
////////////////////////////////////////////////////////////////
+
+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;

View File

@ -1,7 +1,7 @@
diff -bur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm
--- fltk-1.3.0r9619.org/src/Fl_cocoa.mm 2012-06-19 12:54:43.694231638 +0200
+++ fltk-1.3.0r9619/src/Fl_cocoa.mm 2012-06-19 12:57:05.899048602 +0200
@@ -697,12 +697,9 @@
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
@ -15,7 +15,7 @@ diff -bur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm
- (BOOL)canBecomeMainWindow
{
if (Fl::modal_ && (Fl::modal_ != w))
@@ -711,7 +708,6 @@
@@ -675,7 +672,6 @@ void Fl::remove_timeout(Fl_Timeout_Handl
return !(w->tooltip_window() || w->menu_window());
}
@ -23,10 +23,10 @@ diff -bur fltk-1.3.0r9619.org/src/Fl_cocoa.mm fltk-1.3.0r9619/src/Fl_cocoa.mm
@end
diff -bur fltk-1.3.0r9619.org/src/Fl_win32.cxx fltk-1.3.0r9619/src/Fl_win32.cxx
--- fltk-1.3.0r9619.org/src/Fl_win32.cxx 2012-06-19 12:54:43.696231735 +0200
+++ fltk-1.3.0r9619/src/Fl_win32.cxx 2012-06-19 12:54:43.803236862 +0200
@@ -1065,6 +1065,10 @@
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:
@ -37,7 +37,7 @@ diff -bur fltk-1.3.0r9619.org/src/Fl_win32.cxx fltk-1.3.0r9619/src/Fl_win32.cxx
Fl::handle(FL_FOCUS, window);
break;
@@ -1826,6 +1830,11 @@
@@ -1668,6 +1672,11 @@ Fl_X* Fl_X::make(Fl_Window* w) {
Fl::e_number = old_event;
w->redraw(); // force draw to happen
}
@ -49,7 +49,7 @@ diff -bur fltk-1.3.0r9619.org/src/Fl_win32.cxx fltk-1.3.0r9619/src/Fl_win32.cxx
// 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 :
@@ -1843,7 +1852,6 @@
@@ -1685,7 +1694,6 @@ Fl_X* Fl_X::make(Fl_Window* w) {
}
}
@ -57,10 +57,10 @@ diff -bur fltk-1.3.0r9619.org/src/Fl_win32.cxx fltk-1.3.0r9619/src/Fl_win32.cxx
return x;
}
diff -bur 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-19 12:54:43.697231783 +0200
+++ fltk-1.3.0r9619/src/Fl_x.cxx 2012-06-19 12:54:43.804236911 +0200
@@ -2101,6 +2101,12 @@
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

View File

@ -1,6 +1,6 @@
diff -up fltk-1.3.0r9619/FL/Fl_Window.H.multihead fltk-1.3.0r9619/FL/Fl_Window.H
--- fltk-1.3.0r9619/FL/Fl_Window.H.multihead 2012-08-27 11:02:32.646542627 +0200
+++ fltk-1.3.0r9619/FL/Fl_Window.H 2012-08-27 11:02:32.659542408 +0200
diff -up fltk-1.3.x-r9671/FL/Fl_Window.H.multihead fltk-1.3.x-r9671/FL/Fl_Window.H
--- fltk-1.3.x-r9671/FL/Fl_Window.H.multihead 2013-08-21 15:39:12.913459946 -0500
+++ fltk-1.3.x-r9671/FL/Fl_Window.H 2013-08-21 15:39:12.924459833 -0500
@@ -54,7 +54,7 @@ class Fl_RGB_Image;
class FL_EXPORT Fl_Window : public Fl_Group {
@ -33,7 +33,7 @@ diff -up fltk-1.3.0r9619/FL/Fl_Window.H.multihead fltk-1.3.0r9619/FL/Fl_Window.H
friend class Fl_X;
Fl_X *i; // points at the system-specific stuff
@@ -422,13 +438,15 @@ public:
@@ -430,13 +446,15 @@ public:
*/
void show(int argc, char **argv);
/**
@ -52,7 +52,7 @@ diff -up fltk-1.3.0r9619/FL/Fl_Window.H.multihead fltk-1.3.0r9619/FL/Fl_Window.H
*/
void fullscreen();
/**
@@ -445,6 +463,17 @@ public:
@@ -453,6 +471,17 @@ public:
*/
unsigned int fullscreen_active() const { return flags() & FULLSCREEN; }
/**
@ -70,9 +70,9 @@ diff -up fltk-1.3.0r9619/FL/Fl_Window.H.multihead fltk-1.3.0r9619/FL/Fl_Window.H
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 -up fltk-1.3.0r9619/FL/win32.H.multihead fltk-1.3.0r9619/FL/win32.H
--- fltk-1.3.0r9619/FL/win32.H.multihead 2012-08-27 11:02:32.646542627 +0200
+++ fltk-1.3.0r9619/FL/win32.H 2012-08-27 11:02:32.659542408 +0200
diff -up fltk-1.3.x-r9671/FL/win32.H.multihead fltk-1.3.x-r9671/FL/win32.H
--- fltk-1.3.x-r9671/FL/win32.H.multihead 2013-08-21 15:39:12.914459936 -0500
+++ fltk-1.3.x-r9671/FL/win32.H 2013-08-21 15:39:12.925459823 -0500
@@ -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,
@ -81,10 +81,10 @@ diff -up fltk-1.3.0r9619/FL/win32.H.multihead fltk-1.3.0r9619/FL/win32.H
void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
void flush() {w->flush();}
void set_minmax(LPMINMAXINFO minmax);
diff -up fltk-1.3.0r9619/src/Fl_cocoa.mm.multihead fltk-1.3.0r9619/src/Fl_cocoa.mm
--- fltk-1.3.0r9619/src/Fl_cocoa.mm.multihead 2012-08-27 11:02:32.641542711 +0200
+++ fltk-1.3.0r9619/src/Fl_cocoa.mm 2012-08-27 14:00:11.192497864 +0200
@@ -2435,9 +2435,32 @@ void Fl_X::make(Fl_Window* w)
diff -up fltk-1.3.x-r9671/src/Fl_cocoa.mm.multihead fltk-1.3.x-r9671/src/Fl_cocoa.mm
--- fltk-1.3.x-r9671/src/Fl_cocoa.mm.multihead 2013-08-21 15:39:12.907460008 -0500
+++ fltk-1.3.x-r9671/src/Fl_cocoa.mm 2013-08-21 15:39:12.926459813 -0500
@@ -2173,9 +2173,32 @@ void Fl_X::make(Fl_Window* w)
NSRect crect;
if (w->fullscreen_active()) {
@ -120,10 +120,10 @@ diff -up fltk-1.3.0r9619/src/Fl_cocoa.mm.multihead fltk-1.3.0r9619/src/Fl_cocoa.
winstyle = NSBorderlessWindowMask;
winlevel = NSStatusWindowLevel;
}
diff -up fltk-1.3.0r9619/src/Fl_win32.cxx.multihead fltk-1.3.0r9619/src/Fl_win32.cxx
--- fltk-1.3.0r9619/src/Fl_win32.cxx.multihead 2012-08-27 11:02:32.648542593 +0200
+++ fltk-1.3.0r9619/src/Fl_win32.cxx 2012-08-27 11:02:32.662542359 +0200
@@ -1547,19 +1547,42 @@ void Fl_Window::resize(int X,int Y,int W
diff -up fltk-1.3.x-r9671/src/Fl_win32.cxx.multihead fltk-1.3.x-r9671/src/Fl_win32.cxx
--- fltk-1.3.x-r9671/src/Fl_win32.cxx.multihead 2013-08-21 15:39:12.916459915 -0500
+++ fltk-1.3.x-r9671/src/Fl_win32.cxx 2013-08-21 15:39:12.927459802 -0500
@@ -1391,19 +1391,42 @@ void Fl_Window::resize(int X,int Y,int W
}
}
@ -170,7 +170,7 @@ diff -up fltk-1.3.0r9619/src/Fl_win32.cxx.multihead fltk-1.3.0r9619/src/Fl_win32
Fl::handle(FL_FULLSCREEN, this);
}
@@ -1814,8 +1837,8 @@ Fl_X* Fl_X::make(Fl_Window* w) {
@@ -1658,8 +1681,8 @@ Fl_X* Fl_X::make(Fl_Window* w) {
monitor the window was placed on. */
RECT rect;
GetWindowRect(x->xid, &rect);
@ -181,9 +181,9 @@ diff -up fltk-1.3.0r9619/src/Fl_win32.cxx.multihead fltk-1.3.0r9619/src/Fl_win32
}
x->next = Fl_X::first;
diff -up fltk-1.3.0r9619/src/Fl_Window_fullscreen.cxx.multihead fltk-1.3.0r9619/src/Fl_Window_fullscreen.cxx
--- fltk-1.3.0r9619/src/Fl_Window_fullscreen.cxx.multihead 2012-03-23 17:47:53.000000000 +0100
+++ fltk-1.3.0r9619/src/Fl_Window_fullscreen.cxx 2012-08-27 11:02:32.662542359 +0200
diff -up fltk-1.3.x-r9671/src/Fl_Window_fullscreen.cxx.multihead fltk-1.3.x-r9671/src/Fl_Window_fullscreen.cxx
--- fltk-1.3.x-r9671/src/Fl_Window_fullscreen.cxx.multihead 2012-03-23 11:47:53.000000000 -0500
+++ fltk-1.3.x-r9671/src/Fl_Window_fullscreen.cxx 2013-08-21 15:39:12.928459792 -0500
@@ -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;
@ -219,9 +219,9 @@ diff -up fltk-1.3.0r9619/src/Fl_Window_fullscreen.cxx.multihead fltk-1.3.0r9619/
//
// End of "$Id: Fl_Window_fullscreen.cxx 9299 2012-03-23 16:47:53Z manolo $".
diff -up fltk-1.3.0r9619/src/Fl_x.cxx.multihead fltk-1.3.0r9619/src/Fl_x.cxx
--- fltk-1.3.0r9619/src/Fl_x.cxx.multihead 2012-08-27 11:02:32.650542559 +0200
+++ fltk-1.3.0r9619/src/Fl_x.cxx 2012-08-27 11:02:32.663542343 +0200
diff -up fltk-1.3.x-r9671/src/Fl_x.cxx.multihead fltk-1.3.x-r9671/src/Fl_x.cxx
--- fltk-1.3.x-r9671/src/Fl_x.cxx.multihead 2013-08-21 15:39:12.918459895 -0500
+++ fltk-1.3.x-r9671/src/Fl_x.cxx 2013-08-21 15:39:12.929459782 -0500
@@ -352,6 +352,7 @@ Atom fl_NET_WM_ICON_NAME; // utf8 aware
Atom fl_NET_SUPPORTING_WM_CHECK;
Atom fl_NET_WM_STATE;
@ -365,9 +365,9 @@ diff -up fltk-1.3.0r9619/src/Fl_x.cxx.multihead fltk-1.3.0r9619/src/Fl_x.cxx
XChangeProperty (fl_display, xp->xid, fl_NET_WM_STATE, XA_ATOM, 32,
PropModeAppend, (unsigned char*) &fl_NET_WM_STATE_FULLSCREEN, 1);
}
diff -up fltk-1.3.0r9619/test/fullscreen.cxx.multihead fltk-1.3.0r9619/test/fullscreen.cxx
--- fltk-1.3.0r9619/test/fullscreen.cxx.multihead 2012-06-14 17:09:46.000000000 +0200
+++ fltk-1.3.0r9619/test/fullscreen.cxx 2012-08-27 11:02:32.664542326 +0200
diff -up fltk-1.3.x-r9671/test/fullscreen.cxx.multihead fltk-1.3.x-r9671/test/fullscreen.cxx
--- fltk-1.3.x-r9671/test/fullscreen.cxx.multihead 2012-06-14 10:09:46.000000000 -0500
+++ fltk-1.3.x-r9671/test/fullscreen.cxx 2013-08-21 15:39:12.929459782 -0500
@@ -127,7 +127,7 @@ class fullscreen_window : public Fl_Sing
fullscreen_window(int W, int H, const char *t=0);
int handle (int e);

View File

@ -1,19 +0,0 @@
diff -up fltk-1.3.0r9619/src/Fl_x.cxx.expose fltk-1.3.0r9619/src/Fl_x.cxx
--- fltk-1.3.0r9619/src/Fl_x.cxx.expose 2012-07-05 09:49:55.466925868 +0200
+++ fltk-1.3.0r9619/src/Fl_x.cxx 2012-07-05 09:50:24.159428363 +0200
@@ -1838,14 +1838,13 @@ int fl_handle(const XEvent& thisevent)
void Fl_Window::resize(int X,int Y,int W,int H) {
int is_a_move = (X != x() || Y != y());
int is_a_resize = (W != w() || H != h());
- int is_a_enlarge = (W > w() || H > h());
int resize_from_program = (this != resize_bug_fix);
if (!resize_from_program) resize_bug_fix = 0;
if (is_a_move && resize_from_program) set_flag(FORCE_POSITION);
else if (!is_a_resize && !is_a_move) return;
if (is_a_resize) {
Fl_Group::resize(X,Y,W,H);
- if (shown()) {redraw(); if(is_a_enlarge) i->wait_for_expose = 1;}
+ if (shown()) redraw();
} else {
x(X); y(Y);
}

View File

@ -1,6 +1,6 @@
diff -ur fltk-1.3.0r9619.org/FL/Fl_Window.H fltk-1.3.0r9619/FL/Fl_Window.H
--- fltk-1.3.0r9619.org/FL/Fl_Window.H 2012-06-18 16:02:15.133232753 +0200
+++ fltk-1.3.0r9619/FL/Fl_Window.H 2012-06-18 16:02:15.282239896 +0200
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
@ -42,7 +42,7 @@ diff -ur fltk-1.3.0r9619.org/FL/Fl_Window.H fltk-1.3.0r9619/FL/Fl_Window.H
public:
/**
@@ -342,6 +358,18 @@
@@ -350,6 +366,18 @@
static const char *default_xclass();
const char* xclass() const;
void xclass(const char* c);
@ -61,9 +61,9 @@ diff -ur fltk-1.3.0r9619.org/FL/Fl_Window.H fltk-1.3.0r9619/FL/Fl_Window.H
const void* icon() const;
void icon(const void * ic);
diff -ur fltk-1.3.0r9619.org/FL/mac.H fltk-1.3.0r9619/FL/mac.H
--- fltk-1.3.0r9619.org/FL/mac.H 2012-06-18 16:02:15.133232753 +0200
+++ fltk-1.3.0r9619/FL/mac.H 2012-06-18 16:02:15.282239896 +0200
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);
@ -74,9 +74,9 @@ diff -ur fltk-1.3.0r9619.org/FL/mac.H fltk-1.3.0r9619/FL/mac.H
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.0r9619.org/FL/win32.H fltk-1.3.0r9619/FL/win32.H
--- fltk-1.3.0r9619.org/FL/win32.H 2012-06-18 16:02:15.133232753 +0200
+++ fltk-1.3.0r9619/FL/win32.H 2012-06-18 16:02:15.282239896 +0200
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);
@ -87,9 +87,9 @@ diff -ur fltk-1.3.0r9619.org/FL/win32.H fltk-1.3.0r9619/FL/win32.H
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.0r9619.org/FL/x.H fltk-1.3.0r9619/FL/x.H
--- fltk-1.3.0r9619.org/FL/x.H 2012-06-18 16:02:15.133232753 +0200
+++ fltk-1.3.0r9619/FL/x.H 2012-06-18 16:02:15.282239896 +0200
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;}
@ -99,9 +99,9 @@ diff -ur fltk-1.3.0r9619.org/FL/x.H fltk-1.3.0r9619/FL/x.H
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.0r9619.org/src/Fl.cxx fltk-1.3.0r9619/src/Fl.cxx
--- fltk-1.3.0r9619.org/src/Fl.cxx 2012-06-18 16:02:15.125232369 +0200
+++ fltk-1.3.0r9619/src/Fl.cxx 2012-06-18 16:02:15.282239896 +0200
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_);
@ -111,9 +111,9 @@ diff -ur fltk-1.3.0r9619.org/src/Fl.cxx fltk-1.3.0r9619/src/Fl.cxx
}
// FL_SHOW and FL_HIDE are called whenever the visibility of this widget
diff -ur fltk-1.3.0r9619.org/src/Fl_win32.cxx fltk-1.3.0r9619/src/Fl_win32.cxx
--- fltk-1.3.0r9619.org/src/Fl_win32.cxx 2012-06-18 16:02:15.139233034 +0200
+++ fltk-1.3.0r9619/src/Fl_win32.cxx 2012-06-18 16:02:54.100101492 +0200
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);
@ -421,9 +421,9 @@ diff -ur fltk-1.3.0r9619.org/src/Fl_win32.cxx fltk-1.3.0r9619/src/Fl_win32.cxx
if (new_cursor == NULL)
return 0;
diff -ur fltk-1.3.0r9619.org/src/Fl_Window.cxx fltk-1.3.0r9619/src/Fl_Window.cxx
--- fltk-1.3.0r9619.org/src/Fl_Window.cxx 2012-06-18 16:02:15.136232895 +0200
+++ fltk-1.3.0r9619/src/Fl_Window.cxx 2012-06-18 16:03:07.741755716 +0200
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>
@ -512,11 +512,11 @@ diff -ur fltk-1.3.0r9619.org/src/Fl_Window.cxx fltk-1.3.0r9619/src/Fl_Window.cxx
+}
//
// End of "$Id: Fl_Window.cxx 9443 2012-05-05 13:36:47Z AlbrechtS $".
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 16:02:15.140233085 +0200
+++ fltk-1.3.0r9619/src/Fl_x.cxx 2012-06-18 16:03:57.915161919 +0200
@@ -353,6 +353,7 @@
// 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;
@ -524,7 +524,7 @@ diff -ur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx
/*
X defines 32-bit-entities to have a format value of max. 32,
@@ -717,6 +718,7 @@
@@ -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);
@ -532,7 +532,7 @@ diff -ur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx
if (sizeof(Atom) < 4)
atom_bits = sizeof(Atom) * 8;
@@ -2137,12 +2139,14 @@
@@ -2138,12 +2140,14 @@
fl_show_iconic = 0;
showit = 0;
}
@ -549,7 +549,7 @@ diff -ur fltk-1.3.0r9619.org/src/Fl_x.cxx fltk-1.3.0r9619/src/Fl_x.cxx
}
// set the window type for menu and tooltip windows to avoid animations (compiz)
@@ -2262,6 +2266,93 @@
@@ -2263,6 +2267,93 @@
////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,468 @@
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;

View File

@ -1,4 +1,4 @@
%global snap r9671
#global snap r9671
# TODO:
# * port .spec to use cmake
@ -8,8 +8,8 @@
Summary: C++ user interface toolkit
Name: fltk
Version: 1.3.0
Release: 11%{?dist}
Version: 1.3.2
Release: 1%{?dist}
# see COPYING (or http://www.fltk.org/COPYING.php ) for exceptions details
License: LGPLv2+ with exceptions
@ -35,29 +35,26 @@ Patch8: fltk-1.3.0-rh708185.patch
Patch9: fltk-1_v4.3.x-keyboard-x11.patch
# http://www.fltk.org/str.php?L2636
Patch10: fltk-1_v2.3.x-clipboard.patch
Patch11: fltk-1_v2.3.x-clipboard-x11.patch
Patch12: fltk-1_v3.3.x-clipboard-xfixes.patch
Patch10: fltk-1.3.x-r9671-clipboard.patch
Patch11: fltk-1.3.x-r9671-clipboard-x11.patch
Patch12: fltk-1.3.x-r9671-clipboard-xfixes.patch
# http://www.fltk.org/str.php?L2660
Patch13: fltk-1_v4.3.x-cursor.patch
Patch13: fltk-1.3.x-r9671-cursor.patch
Patch20: fltk-1_v4.3.x-cursor-abi.patch
# http://www.fltk.org/str.php?L2859
Patch14: fltk-1.3.x-resize-expose.patch
# http://www.fltk.org/str.php?L2659
Patch15: pixmap.patch
Patch15: http://www.fltk.org/strfiles/2659/pixmap_v2.patch
# http://www.fltk.org/str.php?L2802
Patch16: fltk-1_v2.3.0-modal.patch
Patch16: fltk-1.3.x-r9671-modal.patch
# http://www.fltk.org/str.php?L2816
Patch17: fltk-1_v2.3.0-icons.patch
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: fltk-1_v2.3.x-multihead.patch
Patch19: http://www.fltk.org/strfiles/2860/fltk-1_v3.3.x-multihead.patch
BuildRequires: desktop-file-utils
BuildRequires: libjpeg-devel
@ -113,13 +110,12 @@ Requires: %{name}-devel
%patch5 -p1 -b .fluid_desktop
%patch8 -p1 -b .rh708185
%patch9 -p1 -b .deadkeys
%patch10 -p1 -b .clipboard1
%patch11 -p1 -b .clipboard2
%patch12 -p1 -b .clipboard3
%patch10 -p1 -b .clipboard
%patch11 -p1 -b .clipboard-x11
%patch12 -p1 -b .clipboard-xfixes
%patch13 -p1 -b .cursor
%patch20 -p1 -b .cursor-abi
%patch14 -p1 -b .resize-expose
%patch15 -p0 -b .pixmap
%patch15 -p1 -b .pixmap_v2
%patch16 -p1 -b .modal
%patch17 -p1 -b .icons
%patch18 -p1 -b .screen_num
@ -234,6 +230,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &> /dev/null || :
%changelog
* Mon Aug 26 2013 Rex Dieter <rdieter@fedoraproject.org> 1.3.2-1
- fltk-1.3.2
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.0-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

View File

@ -1,149 +1,25 @@
Index: src/ps_image.cxx
===================================================================
--- src/ps_image.cxx (revision 9132)
+++ src/ps_image.cxx (working copy)
@@ -185,72 +185,38 @@
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>
extern uchar **fl_mask_bitmap;
class Fl_Widget;
+class Fl_Pixmap;
struct Fl_Menu_Item;
struct Fl_Label;
+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;
+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;
+
+ memcpy(buf, curdata, w*cb_data->D);
+}
+
+
+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;
- int i,j, k;
-
- 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);
-
-
if (!LD) LD = iw*D;
- uchar *curmask=mask;
- for (j=0; j<ih;j++){
- if (mask){
+ cb_data.data = data;
+ cb_data.D = D;
+ cb_data.LD = LD;
- 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" );
-
-
+ 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);
Index: src/Fl_Image.cxx
===================================================================
--- src/Fl_Image.cxx (revision 9293)
+++ src/Fl_Image.cxx (working copy)
@@ -163,7 +163,23 @@
//
// RGB image class...
//
-/** 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;
Index: src/fl_draw_pixmap.cxx
===================================================================
--- src/fl_draw_pixmap.cxx (revision 9420)
+++ src/fl_draw_pixmap.cxx (working copy)
@@ -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;
}
@ -537,23 +413,142 @@ Index: src/fl_draw_pixmap.cxx
return 1;
}
Index: FL/Fl_Image.H
===================================================================
--- FL/Fl_Image.H (revision 9601)
+++ FL/Fl_Image.H (working copy)
@@ -25,6 +25,7 @@
# include "Enumerations.H"
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);
class Fl_Widget;
+class Fl_Pixmap;
struct Fl_Menu_Item;
struct Fl_Label;
-/** 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);
@@ -201,6 +202,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()); }

View File

@ -1 +1 @@
b91342317c9344d34457fa0b2884daba fltk-1.3.x-r9671.tar.bz2
9f7e707d4fb7a5a76f0f9b73ff70623d fltk-1.3.2-source.tar.gz