summaryrefslogtreecommitdiff
path: root/src/drivers/WinAPI
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-03-15 06:42:06 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-08-29 12:15:32 +0200
commitc720aae51515907ae82ee02df80bd084f291d4b1 (patch)
tree7fbf3569f35966891df68490b047b30c9ec20bcd /src/drivers/WinAPI
parent28981f6fd3971aaf7ff6527ee1cdeb9d886c4a4a (diff)
Make hybrid Wayland/X11 platform.
Diffstat (limited to 'src/drivers/WinAPI')
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx14
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx2
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx38
3 files changed, 33 insertions, 21 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
index cd6e98646..7952dfdc1 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Gl_Window_Driver.cxx
@@ -1,7 +1,7 @@
//
// Class Fl_WinAPI_Gl_Window_Driver for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2021 by Bill Spitzak and others.
+// Copyright 2021-2022 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -129,8 +129,8 @@ GLContext Fl_WinAPI_Gl_Window_Driver::create_gl_context(Fl_Window* window, const
Fl_X* i = Fl_X::i(window);
HDC hdc = Fl_WinAPI_Window_Driver::driver(window)->private_dc;
if (!hdc) {
- hdc = Fl_WinAPI_Window_Driver::driver(window)->private_dc = GetDCEx(i->xid, 0, DCX_CACHE);
- fl_save_dc(i->xid, hdc);
+ hdc = Fl_WinAPI_Window_Driver::driver(window)->private_dc = GetDCEx((HWND)i->xid, 0, DCX_CACHE);
+ fl_save_dc((HWND)i->xid, hdc);
SetPixelFormat(hdc, ((Fl_WinAPI_Gl_Choice*)g)->pixelformat, (PIXELFORMATDESCRIPTOR*)(&((Fl_WinAPI_Gl_Choice*)g)->pfd));
# if USE_COLORMAP
if (fl_palette) SelectPalette(hdc, fl_palette, FALSE);
@@ -139,7 +139,7 @@ GLContext Fl_WinAPI_Gl_Window_Driver::create_gl_context(Fl_Window* window, const
GLContext context = layer ? wglCreateLayerContext(hdc, layer) : wglCreateContext(hdc);
if (context) {
if (context_list && nContext)
- wglShareLists(context_list[0], context);
+ wglShareLists((HGLRC)context_list[0], (HGLRC)context);
add_context(context);
}
return context;
@@ -150,7 +150,7 @@ void Fl_WinAPI_Gl_Window_Driver::set_gl_context(Fl_Window* w, GLContext context)
if (context != cached_context || w != cached_window) {
cached_context = context;
cached_window = w;
- wglMakeCurrent(Fl_WinAPI_Window_Driver::driver(w)->private_dc, context);
+ wglMakeCurrent(Fl_WinAPI_Window_Driver::driver(w)->private_dc, (HGLRC)context);
}
}
@@ -160,7 +160,7 @@ void Fl_WinAPI_Gl_Window_Driver::delete_gl_context(GLContext context) {
cached_window = 0;
wglMakeCurrent(0, 0);
}
- wglDeleteContext(context);
+ wglDeleteContext((HGLRC)context);
del_context(context);
}
@@ -368,4 +368,6 @@ void Fl_WinAPI_Gl_Window_Driver::get_list(Fl_Font_Descriptor *fd, int r) {
}
+FL_EXPORT HGLRC fl_win32_glcontext(GLContext rc) { return (HGLRC)rc; }
+
#endif // HAVE_GL
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
index be9dac6bd..92f34b9ce 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
@@ -450,7 +450,7 @@ Fl_RGB_Image *Fl_WinAPI_Screen_Driver::read_win_rectangle_unscaled(int X, int Y,
void Fl_WinAPI_Screen_Driver::offscreen_size(Fl_Offscreen off, int &width, int &height)
{
BITMAP bitmap;
- if ( GetObject(off, sizeof(BITMAP), &bitmap) ) {
+ if ( GetObject((HBITMAP)off, sizeof(BITMAP), &bitmap) ) {
width = bitmap.bmWidth;
height = bitmap.bmHeight;
}
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
index 459143dad..5f8c40d8d 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
@@ -317,7 +317,7 @@ void Fl_WinAPI_Window_Driver::flush_double()
for an Fl_Double_Window.
*/
HDC sgc = fl_gc;
- fl_gc = fl_makeDC(other_xid);
+ fl_gc = fl_makeDC((HBITMAP)other_xid);
int savedc = SaveDC(fl_gc);
fl_graphics_driver->gc(fl_gc);
fl_graphics_driver->restore_clip(); // duplicate clip region into new gc
@@ -462,7 +462,7 @@ void Fl_WinAPI_Window_Driver::hide() {
int count = 0;
Fl_Window *win, **doit = NULL;
for (win = Fl::first_window(); win && ip; win = Fl::next_window(win)) {
- if (win->non_modal() && GetWindow(fl_xid(win), GW_OWNER) == ip->xid) {
+ if (win->non_modal() && GetWindow(fl_xid(win), GW_OWNER) == (HWND)ip->xid) {
count++;
}
}
@@ -470,7 +470,7 @@ void Fl_WinAPI_Window_Driver::hide() {
doit = new Fl_Window*[count];
count = 0;
for (win = Fl::first_window(); win && ip; win = Fl::next_window(win)) {
- if (win->non_modal() && GetWindow(fl_xid(win), GW_OWNER) == ip->xid) {
+ if (win->non_modal() && GetWindow(fl_xid(win), GW_OWNER) == (HWND)ip->xid) {
doit[count++] = win;
}
}
@@ -485,14 +485,14 @@ void Fl_WinAPI_Window_Driver::hide() {
// icons(NULL, 0); // free_icons() is called by the Fl_Window destructor
// this little trick keeps the current clipboard alive, even if we are about
// to destroy the window that owns the selection.
- if (GetClipboardOwner()==ip->xid)
+ if (GetClipboardOwner() == (HWND)ip->xid)
fl_update_clipboard();
// Make sure we unlink this window from the clipboard chain
- fl_clipboard_notify_retarget(ip->xid);
+ fl_clipboard_notify_retarget((HWND)ip->xid);
// Send a message to myself so that I'll get out of the event loop...
- PostMessage(ip->xid, WM_APP, 0, 0);
- if (private_dc) fl_release_dc(ip->xid, private_dc);
- if (ip->xid == fl_window && fl_graphics_driver->gc()) {
+ PostMessage((HWND)ip->xid, WM_APP, 0, 0);
+ if (private_dc) fl_release_dc((HWND)ip->xid, private_dc);
+ if ((HWND)ip->xid == fl_window && fl_graphics_driver->gc()) {
fl_release_dc(fl_window, (HDC)fl_graphics_driver->gc());
fl_window = (HWND)-1;
fl_graphics_driver->gc(0);
@@ -505,11 +505,11 @@ void Fl_WinAPI_Window_Driver::hide() {
// this little trickery seems to avoid the popup window stacking problem
HWND p = GetForegroundWindow();
- if (p==GetParent(ip->xid)) {
- ShowWindow(ip->xid, SW_HIDE);
+ if (p==GetParent((HWND)ip->xid)) {
+ ShowWindow((HWND)ip->xid, SW_HIDE);
ShowWindow(p, SW_SHOWNA);
}
- DestroyWindow(ip->xid);
+ DestroyWindow((HWND)ip->xid);
// end of fix for STR#3079
if (count) {
int ii;
@@ -541,7 +541,7 @@ void Fl_WinAPI_Window_Driver::unmap() {
#if !defined(FL_DOXYGEN) // FIXME - silence Doxygen warning
void Fl_WinAPI_Window_Driver::make_fullscreen(int X, int Y, int W, int H) {
- Window xid = fl_xid(pWindow);
+ HWND xid = fl_xid(pWindow);
int top, bottom, left, right;
int sx, sy, sw, sh;
@@ -589,7 +589,7 @@ void Fl_WinAPI_Window_Driver::fullscreen_off(int X, int Y, int W, int H) {
// Remove the xid temporarily so that Fl_WinAPI_Window_Driver::fake_X_wm() behaves like it
// does in Fl_WinAPI_Window_Driver::makeWindow().
HWND xid = fl_xid(pWindow);
- Fl_X::i(pWindow)->xid = NULL;
+ Fl_X::i(pWindow)->xid = 0;
int wx, wy, bt, bx, by;
switch (fake_X_wm(wx, wy, bt, bx, by)) {
case 0:
@@ -603,7 +603,7 @@ void Fl_WinAPI_Window_Driver::fullscreen_off(int X, int Y, int W, int H) {
}
break;
}
- Fl_X::i(pWindow)->xid = xid;
+ Fl_X::i(pWindow)->xid = (fl_uintptr_t)xid;
// compute window position and size in scaled units
float s = Fl::screen_driver()->scale(screen_num());
int scaledX = int(ceil(X*s)), scaledY= int(ceil(Y*s)), scaledW = int(ceil(W*s)), scaledH = int(ceil(H*s));
@@ -712,3 +712,13 @@ void Fl_WinAPI_Window_Driver::resize_after_screen_change(void *data) {
const Fl_Image* Fl_WinAPI_Window_Driver::shape() {
return shape_data_ ? shape_data_->shape_ : NULL;
}
+
+
+HWND fl_win32_xid(const Fl_Window *win) {
+ return (HWND)Fl_Window_Driver::xid(win);
+}
+
+
+Fl_Window *fl_win32_find(HWND xid) {
+ return Fl_Window_Driver::find((fl_uintptr_t)xid);
+}