Move the set_key_window() member function from class Fl_X to class Fl_Cocoa_Window_Driver.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11655 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2016-04-19 06:34:40 +00:00
parent c0f14ca2f0
commit 366f4bfbc9
5 changed files with 8 additions and 9 deletions

View File

@ -129,7 +129,6 @@ public:
Fl_X *next; // chain of mapped windows
static Fl_X* first;
static Fl_X* i(const Fl_Window* w) {return (Fl_X*)w->i;}
static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&);
static void make(Fl_Window*);
static void set_high_resolution(bool);
CGRect* subRect() { return subRect_; } // getter
@ -149,7 +148,6 @@ public:
static void GLcontext_makecurrent(NSOpenGLContext*);
static void GL_cleardrawable(void);
void destroy(void);
void set_key_window(void);
static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h);
static unsigned char *bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel);
private:

View File

@ -1945,11 +1945,11 @@ static void handleUpdateEvent( Fl_Window *window )
}
int Fl_X::fake_X_wm(const Fl_Window* w,int &X,int &Y, int &bt,int &bx, int &by) {
static int fake_X_wm(Fl_Window* w,int &X,int &Y, int &bt,int &bx, int &by) {
int W, H, xoff, yoff, dx, dy;
int ret = bx = by = bt = 0;
if (w->border() && !w->parent()) {
if (w->maxw != w->minw || w->maxh != w->minh) {
if (w->driver()->maxw() != w->driver()->minw() || w->driver()->maxh() != w->driver()->minh()) {
ret = 2;
} else {
ret = 1;
@ -3823,9 +3823,9 @@ static void createAppleMenu(void)
}
void Fl_X::set_key_window()
void Fl_Cocoa_Window_Driver::set_key_window()
{
[xid makeKeyWindow];
[fl_xid(pWindow) makeKeyWindow];
}
static NSImage *imageFromText(const char *text, int *pwidth, int *pheight)

View File

@ -19,6 +19,7 @@
#include "../../config_lib.h"
#include "Fl_Cocoa_Screen_Driver.H"
#include "Fl_Cocoa_Window_Driver.H"
#include "../Quartz/Fl_Font.H"
#include <FL/Fl.H>
#include <FL/x.H>
@ -167,7 +168,7 @@ void Fl_Cocoa_Screen_Driver::grab(Fl_Window* win)
if (win) {
if (!Fl::grab_) {
fl_capture = Fl_X::i(Fl::first_window())->xid;
Fl_X::i(Fl::first_window())->set_key_window();
((Fl_Cocoa_Window_Driver*)Fl::first_window()->driver())->set_key_window();
}
Fl::grab_ = win;
} else {

View File

@ -73,6 +73,7 @@ public:
CGContextRef gc; // graphics context
NSCursor *cursor;
static void q_release_context(Fl_Cocoa_Window_Driver *x = 0); // free all resources associated with gc
void set_key_window();
// --- window data
virtual int decorated_w();

View File

@ -53,8 +53,7 @@ Fl_Cocoa_Window_Driver::~Fl_Cocoa_Window_Driver()
void Fl_Cocoa_Window_Driver::take_focus()
{
Fl_X *x = Fl_X::i(pWindow);
if (x) x->set_key_window();
set_key_window();
}