Skip to content

Commit

Permalink
Add function for getting raw handle of a window under Windows
Browse files Browse the repository at this point in the history
For #133
  • Loading branch information
pwiecz committed Jul 24, 2024
1 parent 5313f8a commit c837371
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
9 changes: 8 additions & 1 deletion window.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <FL/Fl_Window.H>
#include <FL/Fl_Double_Window.H>
#include <FL/platform.H>

#include "event_handler.h"

Expand Down Expand Up @@ -71,9 +72,15 @@ void go_fltk_Window_set_icons(Fl_Window* w, const Fl_RGB_Image *images[], int le
}

void go_fltk_Window_size_range(Fl_Window* w, int minW, int minH, int maxW, int maxH, int deltaX, int deltaY, int aspectRatio) {
w->size_range(minW, minH, maxW, maxH, deltaX, deltaY, aspectRatio);
w->size_range(minW, minH, maxW, maxH, deltaX, deltaY, aspectRatio);
}

#ifdef _WIN32
void* go_fltk_Window_win32_xid(Fl_Window* w) {
return fl_win32_xid(w);
}
#endif

const int go_FL_CURSOR_DEFAULT = (int)FL_CURSOR_DEFAULT;
const int go_FL_CURSOR_ARROW = (int)FL_CURSOR_ARROW;
const int go_FL_CURSOR_CROSS = (int)FL_CURSOR_CROSS;
Expand Down
3 changes: 3 additions & 0 deletions window.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ extern "C" {
extern void go_fltk_Window_set_non_modal(Fl_Window *w);
extern void go_fltk_Window_set_icons(Fl_Window* w, const Fl_RGB_Image* images[], int length);
extern void go_fltk_Window_size_range(Fl_Window* w, int minW, int minH, int maxW, int maxH, int deltaX, int deltaY, int aspectRatio);
#ifdef _WIN32
extern void* go_fltk_Window_win32_xid(Fl_Window* w);
#endif

extern const int go_FL_CURSOR_DEFAULT;
extern const int go_FL_CURSOR_ARROW;
Expand Down
12 changes: 12 additions & 0 deletions window_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//go:build windows

package fltk

/*
#include "window.h"
*/
import "C"

func (w *Window) RawHandle() uintptr {
return uintptr(C.go_fltk_Window_win32_xid((*C.Fl_Window)(w.ptr())))
}

0 comments on commit c837371

Please sign in to comment.