diff options
| -rw-r--r-- | FL/Fl_Window_Driver.H | 1 | ||||
| -rw-r--r-- | FL/mac.H | 2 | ||||
| -rw-r--r-- | FL/win32.H | 1 | ||||
| -rw-r--r-- | FL/x.H | 1 | ||||
| -rw-r--r-- | src/Fl_win32.cxx | 30 | ||||
| -rw-r--r-- | src/Fl_x.cxx | 12 | ||||
| -rw-r--r-- | src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx | 1 | ||||
| -rw-r--r-- | src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx | 1 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 2 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.cxx | 2 |
12 files changed, 26 insertions, 29 deletions
diff --git a/FL/Fl_Window_Driver.H b/FL/Fl_Window_Driver.H index d2d485a52..d701783f3 100644 --- a/FL/Fl_Window_Driver.H +++ b/FL/Fl_Window_Driver.H @@ -145,6 +145,7 @@ public: virtual const void *icon() const {return NULL;} // TODO: check virtual void icon(const void * ic) {} // TODO: check virtual void free_icons() {} // TODO: check + virtual void set_icons() {} // each platform implements this its own way static void default_icons(const Fl_RGB_Image *icons[], int count); @@ -157,8 +157,6 @@ public: static void GL_cleardrawable(void); void destroy(void); void set_key_window(void); - // OS X doesn't have per window icons - 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 --git a/FL/win32.H b/FL/win32.H index 8b841886b..95d3a2bb1 100644 --- a/FL/win32.H +++ b/FL/win32.H @@ -70,7 +70,6 @@ public: void flush() {w->flush();} void set_minmax(LPMINMAXINFO minmax); void mapraise(); - void set_icons(); int set_cursor(Fl_Cursor); int set_cursor(const Fl_RGB_Image*, int, int); static Fl_X* make(Fl_Window*); @@ -125,7 +125,6 @@ public: static Fl_X* i(const Fl_Window* wi) {return wi->i;} void setwindow(Fl_Window* wi) {w=wi; wi->i=this;} void sendxjunk(); - 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 --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index cf2a7eab1..f1f4a38db 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1856,7 +1856,7 @@ Fl_X* Fl_X::make(Fl_Window* w) { x->next = Fl_X::first; Fl_X::first = x; - x->set_icons(); + w->pWindowDriver->set_icons(); if (w->fullscreen_active()) { /* We need to make sure that the fullscreen is created on the @@ -2099,7 +2099,7 @@ void Fl_Window::icons(HICON big_icon, HICON small_icon) ((Fl_WinAPI_Window_Driver*)pWindowDriver)->icon_->small_icon = CopyIcon(small_icon); if (Fl_X::i(this)) - Fl_X::i(this)->set_icons(); + pWindowDriver->set_icons(); } /** Sets the default window icons. @@ -2136,47 +2136,47 @@ void Fl_Window::default_icons(HICON big_icon, HICON small_icon) { default_small_icon = CopyIcon(small_icon); } -void Fl_X::set_icons() { +void Fl_WinAPI_Window_Driver::set_icons() { HICON big_icon, small_icon; // Windows doesn't copy the icons, so we have to "leak" them when // setting, and clean up when we change to some other icons. - big_icon = (HICON)SendMessage(xid, WM_GETICON, ICON_BIG, 0); + big_icon = (HICON)SendMessage(fl_xid(pWindow), WM_GETICON, ICON_BIG, 0); if ((big_icon != NULL) && (big_icon != default_big_icon)) DestroyIcon(big_icon); - small_icon = (HICON)SendMessage(xid, WM_GETICON, ICON_SMALL, 0); + small_icon = (HICON)SendMessage(fl_xid(pWindow), WM_GETICON, ICON_SMALL, 0); if ((small_icon != NULL) && (small_icon != default_small_icon)) DestroyIcon(small_icon); big_icon = NULL; small_icon = NULL; - if (((Fl_WinAPI_Window_Driver*)w->pWindowDriver)->icon_->count) { + if (icon_->count) { const Fl_RGB_Image *best_big, *best_small; best_big = find_best_icon(GetSystemMetrics(SM_CXICON), - (const Fl_RGB_Image **)((Fl_WinAPI_Window_Driver*)w->pWindowDriver)->icon_->icons, - ((Fl_WinAPI_Window_Driver*)w->pWindowDriver)->icon_->count); + (const Fl_RGB_Image **)icon_->icons, + icon_->count); best_small = find_best_icon(GetSystemMetrics(SM_CXSMICON), - (const Fl_RGB_Image **)((Fl_WinAPI_Window_Driver*)w->pWindowDriver)->icon_->icons, - ((Fl_WinAPI_Window_Driver*)w->pWindowDriver)->icon_->count); + (const Fl_RGB_Image **)icon_->icons, + icon_->count); if (best_big != NULL) big_icon = image_to_icon(best_big, true, 0, 0); if (best_small != NULL) small_icon = image_to_icon(best_small, true, 0, 0); } else { - if ((((Fl_WinAPI_Window_Driver*)w->pWindowDriver)->icon_->big_icon != NULL) || (((Fl_WinAPI_Window_Driver*)w->pWindowDriver)->icon_->small_icon != NULL)) { - big_icon = ((Fl_WinAPI_Window_Driver*)w->pWindowDriver)->icon_->big_icon; - small_icon = ((Fl_WinAPI_Window_Driver*)w->pWindowDriver)->icon_->small_icon; + if ((icon_->big_icon != NULL) || (icon_->small_icon != NULL)) { + big_icon = icon_->big_icon; + small_icon = icon_->small_icon; } else { big_icon = default_big_icon; small_icon = default_small_icon; } } - SendMessage(xid, WM_SETICON, ICON_BIG, (LPARAM)big_icon); - SendMessage(xid, WM_SETICON, ICON_SMALL, (LPARAM)small_icon); + SendMessage(fl_xid(pWindow), WM_SETICON, ICON_BIG, (LPARAM)big_icon); + SendMessage(fl_xid(pWindow), WM_SETICON, ICON_SMALL, (LPARAM)small_icon); } diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 9f45072df..ca1e1bb7f 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -2526,7 +2526,7 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap) XSetWMHints(fl_display, xp->xid, hints); XFree(hints); - xp->set_icons(); + win->pWindowDriver->set_icons(); } // set the window type for menu and tooltip windows to avoid animations (compiz) @@ -2707,22 +2707,22 @@ void Fl_Window_Driver::default_icons(const Fl_RGB_Image *icons[], int count) { &default_net_wm_icons, &default_net_wm_icons_size); } -void Fl_X::set_icons() { +void Fl_X11_Window_Driver::set_icons() { unsigned long *net_wm_icons; size_t net_wm_icons_size; - if (((Fl_X11_Window_Driver*)w->pWindowDriver)->icon_->count) { - icons_to_property((const Fl_RGB_Image **)((Fl_X11_Window_Driver*)w->pWindowDriver)->icon_->icons, ((Fl_X11_Window_Driver*)w->pWindowDriver)->icon_->count, + if (icon_->count) { + icons_to_property((const Fl_RGB_Image **)icon_->icons, 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, + XChangeProperty (fl_display, fl_xid(pWindow), fl_NET_WM_ICON, XA_CARDINAL, 32, PropModeReplace, (unsigned char*) net_wm_icons, net_wm_icons_size); - if (((Fl_X11_Window_Driver*)w->pWindowDriver)->icon_->count) { + if (icon_->count) { delete [] net_wm_icons; net_wm_icons = 0L; net_wm_icons_size = 0; diff --git a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx index 9da03bceb..bc9d02b7f 100644 --- a/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx +++ b/src/drivers/PicoAndroid/Fl_PicoAndroid_Screen_Driver.cxx @@ -476,7 +476,6 @@ void Fl::set_color(Fl_Color, unsigned int) { } int Fl_X::set_cursor(Fl_Cursor) { return 0; } int Fl_X::set_cursor(Fl_RGB_Image const*, int, int) { return 0; } -void Fl_X::set_icons() { } //void Fl_Window::size_range_() { } //void Fl_Window::fullscreen_x() { } diff --git a/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx b/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx index 7223e152e..30377c0a9 100644 --- a/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx +++ b/src/drivers/PicoSDL/Fl_PicoSDL_Screen_Driver.cxx @@ -163,7 +163,6 @@ void Fl::set_color(Fl_Color, unsigned int) { } int Fl_X::set_cursor(Fl_Cursor) { return 0; } int Fl_X::set_cursor(Fl_RGB_Image const*, int, int) { return 0; } -void Fl_X::set_icons() { } //void Fl_Window::size_range_() { } //void Fl_Window::fullscreen_x() { } diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H index 3c2b002db..8548bfea0 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H @@ -100,6 +100,7 @@ public: virtual void wait_for_expose(); virtual int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, void (*draw_area)(void*, int,int,int,int), void* data); + virtual void set_icons(); }; diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index 61cc6bcbf..89bd68fee 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -329,7 +329,7 @@ void Fl_WinAPI_Window_Driver::icons(const Fl_RGB_Image *icons[], int count) { } if (Fl_X::i(pWindow)) - Fl_X::i(pWindow)->set_icons(); + set_icons(); } const void *Fl_WinAPI_Window_Driver::icon() const { diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H index cf71bb935..6abd04dca 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.H +++ b/src/drivers/X11/Fl_X11_Window_Driver.H @@ -115,6 +115,7 @@ public: virtual int can_do_overlay(); virtual void redraw_overlay(); virtual int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, void (*draw_area)(void*, int,int,int,int), void* data); + virtual void set_icons(); }; diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index c6784c9cb..187d3ffb9 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx @@ -350,7 +350,7 @@ void Fl_X11_Window_Driver::icons(const Fl_RGB_Image *icons[], int count) { } if (Fl_X::i(pWindow)) - Fl_X::i(pWindow)->set_icons(); + set_icons(); } const void *Fl_X11_Window_Driver::icon() const { |
