Skip to content

Commit

Permalink
Move the set_key_window() member function from class Fl_X to class Fl…
Browse files Browse the repository at this point in the history
…_Cocoa_Window_Driver.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11655 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Apr 19, 2016
1 parent c0f14ca commit 366f4bf
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 0 additions & 2 deletions FL/mac.H
Expand Up @@ -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
Expand All @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions src/Fl_cocoa.mm
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
Expand Up @@ -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>
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
Expand Up @@ -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();
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx
Expand Up @@ -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();
}


Expand Down

0 comments on commit 366f4bf

Please sign in to comment.