Continue removing non window-related member-functions from class Fl_X.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11633 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2016-04-16 13:15:49 +00:00
parent b0ce80f56b
commit c4953935b0
12 changed files with 26 additions and 29 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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*);

1
FL/x.H
View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -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() { }

View File

@ -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() { }

View File

@ -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();
};

View File

@ -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 {

View File

@ -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();
};

View File

@ -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 {