Re: [fltk.development] [RFE] STR #2816: Add ability to set proper window icons

2013-01-21 Thread Pierre Ossman

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature


This patch is ABI safe as it adds no new virtual functions, doesn't modify
the behaviour of existing functions or public members of the class, or
changes the memory layout of the class.

Pointers are always the same size, so changing their type does not modify
the storage. And as you said, this is not a public member.


Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] [RFE] STR #2816: Add ability to set proper window icons

2013-01-21 Thread Ian MacArthur

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature


This being so (the ABI safety of said patch) then I think this would be
good to add... What do others think?


Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] [RFE] STR #2816: Add ability to set proper window icons

2013-01-16 Thread Peter Åstrand
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature


Attached file fltk-1_v3.3.0-icons.patch...


Link: http://www.fltk.org/str.php?L2816
Version: 1.3-featurediff -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:  

Re: [fltk.development] [RFE] STR #2816: Add ability to set proper window icons

2013-01-16 Thread Peter Åstrand

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature


fltk-1_v3.3.0-icons.patch has been adapted for FLTK 1.3.2. Only offset
changes.


Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] [RFE] STR #2816: Add ability to set proper window icons

2013-01-16 Thread Ian MacArthur

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature


The patch looks OK to me, but I worry it may be ABI breaking?

If so, we'll need to put ABI guards around it to stop it breaking any
builds that are using dynamic loading of the fltk libs...

Thoughts?


Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] [RFE] STR #2816: Add ability to set proper window icons

2013-01-16 Thread Greg Ercolano

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature


@Ian: Let me preface by saying I had a weak coffee this morning, so I might
be missing something obvious..

I see you're point.. re: 1.3 to me the scary bit is:
-  const void* icon_;
+  struct icon_data *icon_;

..in Fl_Window.H

Memory-wise, both end up being pointers, so maybe it would squeak by..?
It appears to be private, so no worries about it being referenced by user
code.

I don't think there are changes to the signatures of public functions,
and all the code mods are in .C files.

But someone more awake than I am right now should weigh in..


Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] [RFE] STR #2816: Add ability to set proper window icons

2013-01-16 Thread Ian MacArthur

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature


@Greg:

Quite probably - I'm quite happy to be wrong about ABI issues here, which
is really why I flagged it up, so that someone who knows what they are
talking about (rarely me) can say!

It seems worth having, so if it will fly right, we should do it...


Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] [RFE] STR #2816: Add ability to set proper window icons

2013-01-16 Thread Greg Ercolano

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature


@Ian: Right, I feel the same way. Would like to see Albrecht or Matt weigh
in.

OP, feel free to comment as well on the ABI issue with respect to your
patch(s). Thanks for all your work on this BTW; it is appreciated.. we
just have to be careful we don't break ABI, as we're still in the middle
of a patch release stream, ie. 1.3.x.


Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] [RFE] STR #2816: Add ability to set proper window icons

2012-10-17 Thread Ian MacArthur

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature





Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev


Re: [fltk.development] [RFE] STR #2816: Add ability to set proper window icons

2012-06-19 Thread Peter Åstrand
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature


Attached file fltk-1_v2.3.0-icons.patch...


Link: http://www.fltk.org/str.php?L2816
Version: 1.3-featurediff -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
@@ -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:
 
   /**
@@ -342,6 +358,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.0r9619.org/FL/mac.H fltk-1.3.0r9619/FL/mac.H
--- fltk-1.3.0r9619.org/FL/mac.H2012-06-18 16:02:15.133232753 +0200
+++ fltk-1.3.0r9619/FL/mac.H2012-06-18 16:02:15.282239896 +0200
@@ -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.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
@@ -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.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
@@ -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.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
@@ -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.0r9619.org/src/Fl_win32.cxx fltk-1.3.0r9619/src/Fl_win32.cxx
--- fltk-1.3.0r9619.org/src/Fl_win32.cxx2012-06-18 16:02:15.139233034 
+0200
+++ fltk-1.3.0r9619/src/Fl_win32.cxx2012-06-18 16:02:54.100101492 +0200
@@ -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;
- 

Re: [fltk.development] [RFE] STR #2816: Add ability to set proper window icons

2012-06-19 Thread Peter Åstrand

DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature


Updated patch for latest trunk. I think this patch is important because it
means that FLTK apps can look better, and people cares about that.


Link: http://www.fltk.org/str.php?L2816
Version: 1.3-feature

___
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev