Merge remote-tracking branch 'refs/remotes/origin/master'
This commit is contained in:
commit
70f61a63f4
@ -20,8 +20,6 @@
|
||||
|
||||
typedef struct wld_window *Window;
|
||||
|
||||
extern struct wl_display *fl_display;
|
||||
|
||||
struct flWaylandRegion {
|
||||
int count;
|
||||
struct _cairo_rectangle *rects;
|
||||
@ -30,5 +28,6 @@ struct flWaylandRegion {
|
||||
#include <stdint.h>
|
||||
extern FL_EXPORT uint32_t fl_event_time;
|
||||
|
||||
extern FL_EXPORT struct wl_surface *fl_wl_surface(Window xid);
|
||||
extern FL_EXPORT struct _cairo *fl_wl_cairo();
|
||||
FL_EXPORT struct wl_display *fl_wl_display();
|
||||
FL_EXPORT struct wl_surface *fl_wl_surface(Window xid);
|
||||
FL_EXPORT struct _cairo *fl_wl_cairo();
|
||||
|
@ -161,7 +161,6 @@ in a Fedora 35 Workstation distribution :
|
||||
- libxkbcommon-devel
|
||||
- pango-devel
|
||||
- dbus-devel
|
||||
- libEGL-devel
|
||||
- mesa-libGLU-devel
|
||||
- gtk3-devel <== with this, windows get a GTK-style titlebar
|
||||
- glew-devel <== necessary to use OpenGL version 3 or above
|
||||
|
@ -943,11 +943,11 @@ from X11-specific source code :
|
||||
#endif
|
||||
\endcode
|
||||
|
||||
extern struct wl_display *fl_display;
|
||||
extern struct wl_display *fl_wl_display();
|
||||
\par
|
||||
After fl_open_display() has run, the \c fl_display global variable points to the
|
||||
After fl_open_display() has run, function \c fl_wl_display() returns a pointer to the
|
||||
struct wl_display representing the connection between the application and Wayland.
|
||||
Therefore, \c wl_display_get_fd(fl_display) gives the file descriptor one can
|
||||
For example, \c wl_display_get_fd(fl_wl_display()) gives the file descriptor one can
|
||||
use to communicate with the Wayland compositor according to the Wayland protocol.
|
||||
|
||||
Window fl_xid(const Fl_Window *)
|
||||
|
@ -38,7 +38,7 @@ static int clocale_snprintf(char *buffer, size_t buffer_size, const char *format
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
int retval = Fl::system_driver()->clocale_snprintf(buffer, buffer_size, format, args);
|
||||
int retval = Fl::system_driver()->clocale_vsnprintf(buffer, buffer_size, format, args);
|
||||
va_end(args);
|
||||
return retval;
|
||||
}
|
||||
@ -47,7 +47,7 @@ static int clocale_sscanf(const char *input, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
int retval = Fl::system_driver()->clocale_sscanf(input, format, args);
|
||||
int retval = Fl::system_driver()->clocale_vsscanf(input, format, args);
|
||||
va_end(args);
|
||||
return retval;
|
||||
}
|
||||
|
@ -127,9 +127,9 @@ public:
|
||||
virtual unsigned utf8to_mb(const char* src, unsigned srclen, char* dst, unsigned dstlen);
|
||||
virtual unsigned utf8from_mb(char* dst, unsigned dstlen, const char* src, unsigned srclen);
|
||||
// implement to shield fprintf() from locale changes in decimal point
|
||||
virtual int clocale_printf(FILE *output, const char *format, va_list args);
|
||||
virtual int clocale_snprintf(char *output, size_t output_size, const char *format, va_list args);
|
||||
virtual int clocale_sscanf(const char *input, const char *format, va_list args);
|
||||
virtual int clocale_vprintf(FILE *output, const char *format, va_list args);
|
||||
virtual int clocale_vsnprintf(char *output, size_t output_size, const char *format, va_list args);
|
||||
virtual int clocale_vsscanf(const char *input, const char *format, va_list args);
|
||||
// implement functions telling whether a key is pressed
|
||||
virtual int event_key(int) {return 0;}
|
||||
virtual int get_key(int) {return 0;}
|
||||
|
@ -401,15 +401,15 @@ unsigned Fl_System_Driver::utf8from_mb(char* dst, unsigned dstlen, const char* s
|
||||
return srclen;
|
||||
}
|
||||
|
||||
int Fl_System_Driver::clocale_printf(FILE *output, const char *format, va_list args) {
|
||||
int Fl_System_Driver::clocale_vprintf(FILE *output, const char *format, va_list args) {
|
||||
return vfprintf(output, format, args);
|
||||
}
|
||||
|
||||
int Fl_System_Driver::clocale_snprintf(char *output, size_t output_size, const char *format, va_list args) {
|
||||
int Fl_System_Driver::clocale_vsnprintf(char *output, size_t output_size, const char *format, va_list args) {
|
||||
return 0; // overridden in platform drivers
|
||||
}
|
||||
|
||||
int Fl_System_Driver::clocale_sscanf(const char *input, const char *format, va_list args) {
|
||||
int Fl_System_Driver::clocale_vsscanf(const char *input, const char *format, va_list args) {
|
||||
return 0; // overridden in platform drivers
|
||||
}
|
||||
|
||||
@ -509,7 +509,7 @@ void Fl_System_Driver::gettime(time_t *sec, int *usec) {
|
||||
Platform drivers \b MUST override this virtual method to do
|
||||
their own stuff and call this base class method to run
|
||||
the platform independent wait functions.
|
||||
|
||||
|
||||
Overriden methods will typically call this method early and perform
|
||||
platform-specific operations after that in order to work with the
|
||||
\p time_to_wait value possibly modified by this method.
|
||||
|
@ -44,9 +44,9 @@ public:
|
||||
Fl_Darwin_System_Driver();
|
||||
virtual int single_arg(const char *arg);
|
||||
virtual int arg_and_value(const char *name, const char *value);
|
||||
virtual int clocale_printf(FILE *output, const char *format, va_list args);
|
||||
virtual int clocale_snprintf(char *output, size_t output_size, const char *format, va_list args);
|
||||
virtual int clocale_sscanf(const char *input, const char *format, va_list args);
|
||||
virtual int clocale_vprintf(FILE *output, const char *format, va_list args);
|
||||
virtual int clocale_vsnprintf(char *output, size_t output_size, const char *format, va_list args);
|
||||
virtual int clocale_vsscanf(const char *input, const char *format, va_list args);
|
||||
static void *get_carbon_function(const char *name);
|
||||
static int calc_mac_os_version(); // computes the fl_mac_os_version global variable
|
||||
static unsigned short *compute_macKeyLookUp();
|
||||
|
@ -110,7 +110,7 @@ int Fl_Darwin_System_Driver::arg_and_value(const char *name, const char *value)
|
||||
static locale_t postscript_locale = NULL;
|
||||
#endif
|
||||
|
||||
int Fl_Darwin_System_Driver::clocale_printf(FILE *output, const char *format, va_list args) {
|
||||
int Fl_Darwin_System_Driver::clocale_vprintf(FILE *output, const char *format, va_list args) {
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||
if (fl_mac_os_version >= 100400) {
|
||||
if (!postscript_locale)
|
||||
@ -125,7 +125,7 @@ int Fl_Darwin_System_Driver::clocale_printf(FILE *output, const char *format, va
|
||||
return retval;
|
||||
}
|
||||
|
||||
int Fl_Darwin_System_Driver::clocale_snprintf(char *output, size_t output_size, const char *format, va_list args) {
|
||||
int Fl_Darwin_System_Driver::clocale_vsnprintf(char *output, size_t output_size, const char *format, va_list args) {
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||
if (fl_mac_os_version >= 100400) {
|
||||
if (!postscript_locale)
|
||||
@ -140,7 +140,7 @@ int Fl_Darwin_System_Driver::clocale_snprintf(char *output, size_t output_size,
|
||||
return retval;
|
||||
}
|
||||
|
||||
int Fl_Darwin_System_Driver::clocale_sscanf(const char *input, const char *format, va_list args) {
|
||||
int Fl_Darwin_System_Driver::clocale_vsscanf(const char *input, const char *format, va_list args) {
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||
if (fl_mac_os_version >= 100400) {
|
||||
if (!postscript_locale)
|
||||
|
@ -261,7 +261,7 @@ int Fl_PostScript_Graphics_Driver::clocale_printf(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
int retval = Fl::system_driver()->clocale_printf(output, format, args);
|
||||
int retval = Fl::system_driver()->clocale_vprintf(output, format, args);
|
||||
va_end(args);
|
||||
return retval;
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ class Fl_RGB_Image;
|
||||
|
||||
class FL_EXPORT Fl_Unix_System_Driver : public Fl_Posix_System_Driver {
|
||||
public:
|
||||
virtual int clocale_snprintf(char *output, size_t output_size, const char *format, va_list args);
|
||||
virtual int clocale_sscanf(const char *input, const char *format, va_list args);
|
||||
virtual int clocale_printf(FILE *output, const char *format, va_list args);
|
||||
virtual int clocale_vsnprintf(char *output, size_t output_size, const char *format, va_list args);
|
||||
virtual int clocale_vsscanf(const char *input, const char *format, va_list args);
|
||||
virtual int clocale_vprintf(FILE *output, const char *format, va_list args);
|
||||
virtual int filename_list(const char *d, dirent ***list,
|
||||
int (*sort)(struct dirent **, struct dirent **),
|
||||
char *errmsg=NULL, int errmsg_sz=0);
|
||||
|
@ -73,7 +73,7 @@ static locale_t c_locale = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
int Fl_Unix_System_Driver::clocale_printf(FILE *output, const char *format, va_list args) {
|
||||
int Fl_Unix_System_Driver::clocale_vprintf(FILE *output, const char *format, va_list args) {
|
||||
#if defined(__linux__) && defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700
|
||||
if (!c_locale)
|
||||
c_locale = newlocale(LC_NUMERIC_MASK, "C", duplocale(LC_GLOBAL_LOCALE));
|
||||
@ -89,7 +89,7 @@ int Fl_Unix_System_Driver::clocale_printf(FILE *output, const char *format, va_l
|
||||
return retval;
|
||||
}
|
||||
|
||||
int Fl_Unix_System_Driver::clocale_snprintf(char *output, size_t output_size, const char *format, va_list args) {
|
||||
int Fl_Unix_System_Driver::clocale_vsnprintf(char *output, size_t output_size, const char *format, va_list args) {
|
||||
#if defined(__linux__) && defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700
|
||||
if (!c_locale)
|
||||
c_locale = newlocale(LC_NUMERIC_MASK, "C", duplocale(LC_GLOBAL_LOCALE));
|
||||
@ -105,7 +105,7 @@ int Fl_Unix_System_Driver::clocale_snprintf(char *output, size_t output_size, co
|
||||
return retval;
|
||||
}
|
||||
|
||||
int Fl_Unix_System_Driver::clocale_sscanf(const char *input, const char *format, va_list args) {
|
||||
int Fl_Unix_System_Driver::clocale_vsscanf(const char *input, const char *format, va_list args) {
|
||||
#if defined(__linux__) && defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700
|
||||
if (!c_locale)
|
||||
c_locale = newlocale(LC_NUMERIC_MASK, "C", duplocale(LC_GLOBAL_LOCALE));
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
Fl_Wayland_Copy_Surface_Driver::Fl_Wayland_Copy_Surface_Driver(int w, int h) : Fl_Copy_Surface_Driver(w, h) {
|
||||
int os_scale = (fl_window ? fl_window->scale : 1);
|
||||
int os_scale = (Fl_Wayland_Window_Driver::wld_window ? Fl_Wayland_Window_Driver::wld_window->scale : 1);
|
||||
img_surf = new Fl_Image_Surface(w * os_scale, h * os_scale);
|
||||
driver(img_surf->driver());
|
||||
driver()->scale(os_scale);
|
||||
|
@ -62,8 +62,8 @@ Fl_Wayland_Gl_Window_Driver::Fl_Wayland_Gl_Window_Driver(Fl_Gl_Window *win) : Fl
|
||||
void Fl_Wayland_Gl_Window_Driver::init() {
|
||||
EGLint major, minor;
|
||||
|
||||
if (!fl_display) Fl::screen_driver()->open_display();
|
||||
egl_display = eglGetDisplay((EGLNativeDisplayType) fl_display);
|
||||
if (!Fl_Wayland_Screen_Driver::wl_display) Fl::screen_driver()->open_display();
|
||||
egl_display = eglGetDisplay((EGLNativeDisplayType) Fl_Wayland_Screen_Driver::wl_display);
|
||||
if (egl_display == EGL_NO_DISPLAY) {
|
||||
Fl::fatal("Can't create egl display\n");
|
||||
}
|
||||
@ -77,17 +77,17 @@ void Fl_Wayland_Gl_Window_Driver::init() {
|
||||
//printf("EGL has %d configs\n", configs_count);
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
|
||||
gl_event_queue = wl_display_create_queue(fl_display);
|
||||
gl_event_queue = wl_display_create_queue(Fl_Wayland_Screen_Driver::wl_display);
|
||||
}
|
||||
|
||||
|
||||
char *Fl_Wayland_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n, int w, int h, Fl_Fontsize fs)
|
||||
{
|
||||
// write str to a bitmap just big enough
|
||||
Window save_win = fl_window;
|
||||
fl_window = NULL;
|
||||
struct wld_window *save_win = Fl_Wayland_Window_Driver::wld_window;
|
||||
fl_window = Fl_Wayland_Window_Driver::wld_window = NULL;
|
||||
Fl_Image_Surface *surf = new Fl_Image_Surface(w, h);
|
||||
fl_window = save_win;
|
||||
fl_window = Fl_Wayland_Window_Driver::wld_window = save_win;
|
||||
Fl_Font f=fl_font();
|
||||
Fl_Surface_Device::push_current(surf);
|
||||
fl_color(FL_BLACK);
|
||||
@ -246,7 +246,7 @@ void Fl_Wayland_Gl_Window_Driver::make_current_before() {
|
||||
struct wl_callback *callback = wl_surface_frame(surface);
|
||||
wl_surface_commit(surface);
|
||||
wl_callback_add_listener(callback, &gl_surface_frame_listener, &done);
|
||||
while (!done) wl_display_dispatch(fl_display);
|
||||
while (!done) wl_display_dispatch(Fl_Wayland_Screen_Driver::wl_display);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -301,11 +301,11 @@ void Fl_Wayland_Gl_Window_Driver::swap_buffers() {
|
||||
if (egl_surface) {
|
||||
//eglSwapInterval(egl_display, 0); // doesn't seem to have any effect in this context
|
||||
if (!egl_resize_in_progress) {
|
||||
while (wl_display_prepare_read(fl_display) != 0) {
|
||||
wl_display_dispatch_pending(fl_display);
|
||||
while (wl_display_prepare_read(Fl_Wayland_Screen_Driver::wl_display) != 0) {
|
||||
wl_display_dispatch_pending(Fl_Wayland_Screen_Driver::wl_display);
|
||||
}
|
||||
wl_display_read_events(fl_display);
|
||||
wl_display_dispatch_queue_pending(fl_display, gl_event_queue);
|
||||
wl_display_read_events(Fl_Wayland_Screen_Driver::wl_display);
|
||||
wl_display_dispatch_queue_pending(Fl_Wayland_Screen_Driver::wl_display, gl_event_queue);
|
||||
}
|
||||
egl_resize_in_progress = false;
|
||||
eglSwapBuffers(Fl_Wayland_Gl_Window_Driver::egl_display, egl_surface);
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
class Fl_Wayland_Image_Surface_Driver : public Fl_Image_Surface_Driver {
|
||||
virtual void end_current();
|
||||
Window pre_window;
|
||||
struct wld_window *pre_window;
|
||||
public:
|
||||
Fl_Wayland_Image_Surface_Driver(int w, int h, int high_res, Fl_Offscreen off);
|
||||
~Fl_Wayland_Image_Surface_Driver();
|
||||
|
@ -25,8 +25,8 @@ Fl_Wayland_Image_Surface_Driver::Fl_Wayland_Image_Surface_Driver(int w, int h, i
|
||||
float d = 1;
|
||||
if (!off) {
|
||||
fl_open_display();
|
||||
if (fl_window) {
|
||||
d = fl_window->scale;
|
||||
if (Fl_Wayland_Window_Driver::wld_window) {
|
||||
d = Fl_Wayland_Window_Driver::wld_window->scale;
|
||||
}
|
||||
d *= fl_graphics_driver->scale();
|
||||
if (d != 1 && high_res) {
|
||||
@ -56,14 +56,14 @@ Fl_Wayland_Image_Surface_Driver::~Fl_Wayland_Image_Surface_Driver() {
|
||||
void Fl_Wayland_Image_Surface_Driver::set_current() {
|
||||
Fl_Surface_Device::set_current();
|
||||
((Fl_Wayland_Graphics_Driver*)fl_graphics_driver)->activate(offscreen, driver()->scale());
|
||||
pre_window = fl_window;
|
||||
fl_window = NULL;
|
||||
pre_window = Fl_Wayland_Window_Driver::wld_window;
|
||||
fl_window = Fl_Wayland_Window_Driver::wld_window = NULL;
|
||||
}
|
||||
|
||||
void Fl_Wayland_Image_Surface_Driver::end_current() {
|
||||
cairo_surface_t *surf = cairo_get_target(offscreen->cairo_);
|
||||
cairo_surface_flush(surf);
|
||||
fl_window = pre_window;
|
||||
fl_window = Fl_Wayland_Window_Driver::wld_window = pre_window;
|
||||
}
|
||||
|
||||
void Fl_Wayland_Image_Surface_Driver::translate(int x, int y) {
|
||||
|
@ -63,6 +63,7 @@ class FL_EXPORT Fl_Wayland_Screen_Driver : public Fl_Screen_Driver
|
||||
static int insertion_point_height;
|
||||
static bool insertion_point_location_is_valid;
|
||||
public:
|
||||
static struct wl_display *wl_display;
|
||||
static void insertion_point_location(int x, int y, int height);
|
||||
static bool insertion_point_location(int *px, int *py, int *pwidth, int *pheight);
|
||||
int get_mouse_unscaled(int &xx, int &yy);
|
||||
|
@ -157,8 +157,6 @@ extern const char *fl_bg2;
|
||||
// end of extern additions workaround
|
||||
|
||||
|
||||
FL_EXPORT struct wl_display *fl_display = NULL;
|
||||
|
||||
static bool has_xrgb = false;
|
||||
|
||||
|
||||
@ -225,6 +223,9 @@ static inline void checkdouble() {
|
||||
}
|
||||
|
||||
|
||||
struct wl_display *Fl_Wayland_Screen_Driver::wl_display = NULL;
|
||||
|
||||
|
||||
Fl_Window *Fl_Wayland_Screen_Driver::surface_to_window(struct wl_surface *surface) {
|
||||
Fl_X *xp = Fl_X::first;
|
||||
while (xp) {
|
||||
@ -749,7 +750,7 @@ void text_input_enter(void *data, struct zwp_text_input_v3 *zwp_text_input_v3,
|
||||
zwp_text_input_v3_set_cursor_rectangle(zwp_text_input_v3, x, y, width, height);
|
||||
}
|
||||
zwp_text_input_v3_commit(zwp_text_input_v3);
|
||||
wl_display_roundtrip(fl_display);
|
||||
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
|
||||
}
|
||||
|
||||
void text_input_leave(void *data, struct zwp_text_input_v3 *zwp_text_input_v3,
|
||||
@ -1059,7 +1060,6 @@ Fl_Wayland_Screen_Driver::Fl_Wayland_Screen_Driver() : Fl_Screen_Driver() {
|
||||
}
|
||||
|
||||
void Fl_Wayland_Screen_Driver::open_display_platform() {
|
||||
struct wl_display *wl_display;
|
||||
struct wl_registry *wl_registry;
|
||||
|
||||
static bool beenHereDoneThat = false;
|
||||
@ -1071,7 +1071,6 @@ void Fl_Wayland_Screen_Driver::open_display_platform() {
|
||||
if (!wl_display) {
|
||||
Fl::fatal("No Wayland connection\n");
|
||||
}
|
||||
fl_display = wl_display;
|
||||
wl_list_init(&seats);
|
||||
wl_list_init(&outputs);
|
||||
|
||||
@ -1090,8 +1089,9 @@ void Fl_Wayland_Screen_Driver::open_display_platform() {
|
||||
}
|
||||
|
||||
void Fl_Wayland_Screen_Driver::close_display() {
|
||||
Fl::remove_fd(wl_display_get_fd(fl_display));
|
||||
wl_display_disconnect(fl_display);
|
||||
Fl::remove_fd(wl_display_get_fd(Fl_Wayland_Screen_Driver::wl_display));
|
||||
wl_display_disconnect(Fl_Wayland_Screen_Driver::wl_display);
|
||||
Fl_Wayland_Screen_Driver::wl_display = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -1112,7 +1112,7 @@ void Fl_Wayland_Screen_Driver::init_workarea()
|
||||
|
||||
|
||||
int Fl_Wayland_Screen_Driver::x() {
|
||||
if (!fl_display) open_display();
|
||||
if (!Fl_Wayland_Screen_Driver::wl_display) open_display();
|
||||
Fl_Wayland_Screen_Driver::output *output;
|
||||
wl_list_for_each(output, &outputs, link) {
|
||||
break;
|
||||
@ -1121,7 +1121,7 @@ int Fl_Wayland_Screen_Driver::x() {
|
||||
}
|
||||
|
||||
int Fl_Wayland_Screen_Driver::y() {
|
||||
if (!fl_display) open_display();
|
||||
if (!Fl_Wayland_Screen_Driver::wl_display) open_display();
|
||||
Fl_Wayland_Screen_Driver::output *output;
|
||||
wl_list_for_each(output, &outputs, link) {
|
||||
break;
|
||||
@ -1130,7 +1130,7 @@ int Fl_Wayland_Screen_Driver::y() {
|
||||
}
|
||||
|
||||
int Fl_Wayland_Screen_Driver::w() {
|
||||
if (!fl_display) open_display();
|
||||
if (!Fl_Wayland_Screen_Driver::wl_display) open_display();
|
||||
Fl_Wayland_Screen_Driver::output *output;
|
||||
wl_list_for_each(output, &outputs, link) {
|
||||
break;
|
||||
@ -1139,7 +1139,7 @@ int Fl_Wayland_Screen_Driver::w() {
|
||||
}
|
||||
|
||||
int Fl_Wayland_Screen_Driver::h() {
|
||||
if (!fl_display) open_display();
|
||||
if (!Fl_Wayland_Screen_Driver::wl_display) open_display();
|
||||
Fl_Wayland_Screen_Driver::output *output;
|
||||
wl_list_for_each(output, &outputs, link) {
|
||||
break;
|
||||
@ -1149,7 +1149,7 @@ int Fl_Wayland_Screen_Driver::h() {
|
||||
|
||||
|
||||
void Fl_Wayland_Screen_Driver::init() {
|
||||
if (!fl_display) open_display();
|
||||
if (!Fl_Wayland_Screen_Driver::wl_display) open_display();
|
||||
}
|
||||
|
||||
|
||||
@ -1219,8 +1219,8 @@ void Fl_Wayland_Screen_Driver::beep(int type)
|
||||
|
||||
void Fl_Wayland_Screen_Driver::flush()
|
||||
{
|
||||
if (fl_display) {
|
||||
wl_display_flush(fl_display);
|
||||
if (Fl_Wayland_Screen_Driver::wl_display) {
|
||||
wl_display_flush(Fl_Wayland_Screen_Driver::wl_display);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1245,13 +1245,6 @@ void Fl_Wayland_Screen_Driver::grab(Fl_Window* win)
|
||||
} else {
|
||||
if (Fl::grab()) {
|
||||
// We must keep the grab in the non-EWMH fullscreen case
|
||||
if (!fullscreen_win ) {
|
||||
//XUngrabKeyboard(fl_display, fl_event_time);
|
||||
}
|
||||
//XUngrabPointer(fl_display, fl_event_time);
|
||||
// this flush is done in case the picked menu item goes into
|
||||
// an infinite loop, so we don't leave the X server locked up:
|
||||
//XFlush(fl_display);
|
||||
Fl::grab_ = 0; // FIXME: Fl::grab_ "should be private", but we need
|
||||
// a way to *set* the variable from the driver!
|
||||
fl_fix_focus();
|
||||
|
@ -88,6 +88,7 @@ public:
|
||||
struct xdg_toplevel *xdg_toplevel();
|
||||
Fl_Wayland_Window_Driver(Fl_Window*);
|
||||
virtual ~Fl_Wayland_Window_Driver();
|
||||
static struct wld_window *wld_window;
|
||||
static void redraw(struct wld_window *window);
|
||||
|
||||
static inline Fl_Wayland_Window_Driver* driver(const Fl_Window *w) {return (Fl_Wayland_Window_Driver*)Fl_Window_Driver::driver(w);}
|
||||
|
@ -52,6 +52,7 @@ extern "C" {
|
||||
#define fl_max(a,b) ((a) > (b) ? (a) : (b))
|
||||
|
||||
Window fl_window;
|
||||
struct wld_window *Fl_Wayland_Window_Driver::wld_window = NULL;
|
||||
|
||||
|
||||
void Fl_Wayland_Window_Driver::destroy_double_buffer() {
|
||||
@ -405,7 +406,7 @@ void Fl_Wayland_Window_Driver::make_current() {
|
||||
}
|
||||
|
||||
fl_graphics_driver->clip_region(0);
|
||||
fl_window = window;
|
||||
fl_window = Fl_Wayland_Window_Driver::wld_window = window;
|
||||
if (!window->buffer) {
|
||||
window->buffer = Fl_Wayland_Graphics_Driver::create_shm_buffer(
|
||||
pWindow->w() * scale, pWindow->h() * scale);
|
||||
@ -636,21 +637,6 @@ void Fl_Wayland_Window_Driver::show_with_args_begin() {
|
||||
|
||||
if (Fl::first_window()) key = Fl::first_window()->xclass();
|
||||
if (!key) key = "fltk";
|
||||
|
||||
/*const char *val = XGetDefault(fl_display, key, "dndTextOps");
|
||||
if (val) Fl::dnd_text_ops(strcasecmp(val, "true") == 0 ||
|
||||
strcasecmp(val, "on") == 0 ||
|
||||
strcasecmp(val, "yes") == 0);
|
||||
|
||||
val = XGetDefault(fl_display, key, "tooltips");
|
||||
if (val) Fl_Tooltip::enable(strcasecmp(val, "true") == 0 ||
|
||||
strcasecmp(val, "on") == 0 ||
|
||||
strcasecmp(val, "yes") == 0);
|
||||
|
||||
val = XGetDefault(fl_display, key, "visibleFocus");
|
||||
if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 ||
|
||||
strcasecmp(val, "on") == 0 ||
|
||||
strcasecmp(val, "yes") == 0);*/
|
||||
}
|
||||
|
||||
|
||||
@ -662,8 +648,6 @@ void Fl_Wayland_Window_Driver::show_with_args_end(int argc, char **argv) {
|
||||
char *buffer = new char[n];
|
||||
char *p = buffer;
|
||||
for (j=0; j<argc; j++) for (const char *q = argv[j]; (*p++ = *q++););
|
||||
//XChangeProperty(fl_display, fl_xid(pWindow), XA_WM_COMMAND, XA_STRING, 8, 0,
|
||||
// (unsigned char *)buffer, p-buffer-1);
|
||||
delete[] buffer;
|
||||
}
|
||||
}
|
||||
@ -875,10 +859,10 @@ void Fl_Wayland_Window_Driver::wait_for_expose()
|
||||
Window xid = fl_xid(pWindow);
|
||||
if (xid->kind == DECORATED) {
|
||||
while (!(xid->state & LIBDECOR_WINDOW_STATE_FULLSCREEN) || !(xid->state & LIBDECOR_WINDOW_STATE_ACTIVE)) {
|
||||
wl_display_dispatch(fl_display);
|
||||
wl_display_dispatch(Fl_Wayland_Screen_Driver::wl_display);
|
||||
}
|
||||
} else if (xid->kind == UNFRAMED) {
|
||||
wl_display_roundtrip(fl_display);
|
||||
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1114,7 +1098,7 @@ Fl_X *Fl_Wayland_Window_Driver::makeWindow()
|
||||
|
||||
} else if ( pWindow->border() && !pWindow->parent() ) { // a decorated window
|
||||
new_window->kind = DECORATED;
|
||||
if (!scr_driver->libdecor_context) scr_driver->libdecor_context = libdecor_new(fl_display, &libdecor_iface);
|
||||
if (!scr_driver->libdecor_context) scr_driver->libdecor_context = libdecor_new(Fl_Wayland_Screen_Driver::wl_display, &libdecor_iface);
|
||||
new_window->frame = libdecor_decorate(scr_driver->libdecor_context, new_window->wl_surface,
|
||||
&libdecor_frame_iface, new_window);
|
||||
//fprintf(stderr, "makeWindow: libdecor_decorate=%p pos:%dx%d\n", new_window->frame, pWindow->x(), pWindow->y());
|
||||
@ -1378,8 +1362,8 @@ void Fl_Wayland_Window_Driver::fullscreen_on() {
|
||||
if (xdg_toplevel()) {
|
||||
xdg_toplevel_set_fullscreen(xdg_toplevel(), NULL);
|
||||
pWindow->_set_fullscreen();
|
||||
wl_display_roundtrip(fl_display); // OK, but try to find something more specific
|
||||
wl_display_roundtrip(fl_display);
|
||||
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display); // OK, but try to find something more specific
|
||||
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
|
||||
Fl::handle(FL_FULLSCREEN, pWindow);
|
||||
}
|
||||
}
|
||||
@ -1490,6 +1474,7 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) {
|
||||
fl_win->configured_width = W;
|
||||
fl_win->configured_height = H;
|
||||
if (!in_handle_configure && xdg_toplevel()) {
|
||||
if (Fl_Window::is_a_rescale()) size_range();
|
||||
struct libdecor_state *state = libdecor_state_new(int(W * f), int(H * f));
|
||||
libdecor_frame_commit(fl_win->frame, state, NULL); // necessary only if resize is initiated by prog
|
||||
libdecor_state_free(state);
|
||||
@ -1562,12 +1547,12 @@ void Fl_Wayland_Window_Driver::reposition_menu_window(int x, int y) {
|
||||
xdg_positioner_destroy(positioner);
|
||||
xdg_popup_add_listener(xid_menu->xdg_popup, &popup_listener, xid_menu);
|
||||
wl_surface_commit(xid_menu->wl_surface);
|
||||
wl_display_roundtrip(fl_display);
|
||||
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
|
||||
// delete the previous popup
|
||||
xdg_popup_destroy(old_popup);
|
||||
xdg_surface_destroy(old_xdg);
|
||||
wl_surface_destroy(old_surface);
|
||||
wl_display_roundtrip(fl_display);
|
||||
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
|
||||
this->y(true_y);
|
||||
}
|
||||
|
||||
@ -1584,10 +1569,16 @@ void Fl_Wayland_Window_Driver::menu_window_area(int &X, int &Y, int &W, int &H,
|
||||
}
|
||||
|
||||
|
||||
FL_EXPORT struct wl_surface *fl_wl_surface(Window xid) {
|
||||
struct wl_surface *fl_wl_surface(Window xid) {
|
||||
return xid->wl_surface;
|
||||
}
|
||||
|
||||
FL_EXPORT struct _cairo *fl_wl_cairo() {
|
||||
|
||||
struct _cairo *fl_wl_cairo() {
|
||||
return ((Fl_Cairo_Graphics_Driver*)fl_graphics_driver)->cr();
|
||||
}
|
||||
|
||||
|
||||
struct wl_display *fl_wl_display() {
|
||||
return Fl_Wayland_Screen_Driver::wl_display;
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ static void get_clipboard_or_dragged_text(struct wl_data_offer *offer) {
|
||||
if (pipe(fds)) return;
|
||||
wl_data_offer_receive(offer, wld_plain_text_clipboard, fds[1]);
|
||||
close(fds[1]);
|
||||
wl_display_flush(fl_display);
|
||||
wl_display_flush(Fl_Wayland_Screen_Driver::wl_display);
|
||||
// read in fl_selection_buffer
|
||||
char *to = fl_selection_buffer[1];
|
||||
ssize_t rest = fl_selection_buffer_length[1];
|
||||
@ -370,7 +370,7 @@ static void get_clipboard_or_dragged_text(struct wl_data_offer *offer) {
|
||||
if (pipe(fds)) return;
|
||||
wl_data_offer_receive(offer, wld_plain_text_clipboard, fds[1]);
|
||||
close(fds[1]);
|
||||
wl_display_flush(fl_display);
|
||||
wl_display_flush(Fl_Wayland_Screen_Driver::wl_display);
|
||||
if (rest+1 > fl_selection_buffer_length[1]) {
|
||||
delete[] fl_selection_buffer[1];
|
||||
fl_selection_buffer[1] = new char[rest+1000+1];
|
||||
@ -431,7 +431,7 @@ static void data_device_handle_motion(void *data, struct wl_data_device *data_de
|
||||
uint32_t supported_actions = ret ? WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY : WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
|
||||
uint32_t preferred_action = supported_actions;
|
||||
wl_data_offer_set_actions(current_drag_offer, supported_actions, preferred_action);
|
||||
wl_display_roundtrip(fl_display);
|
||||
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
|
||||
if (ret && current_drag_offer) wl_data_offer_accept(current_drag_offer, fl_dnd_serial, "text/plain");
|
||||
}
|
||||
|
||||
@ -488,7 +488,7 @@ static int get_clipboard_image() {
|
||||
if (pipe(fds)) return 1;
|
||||
wl_data_offer_receive(fl_selection_offer, fl_selection_offer_type, fds[1]);
|
||||
close(fds[1]);
|
||||
wl_display_roundtrip(fl_display);
|
||||
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
|
||||
if (strcmp(fl_selection_offer_type, "image/png") == 0) {
|
||||
char tmp_fname[21];
|
||||
Fl_Shared_Image *shared = 0;
|
||||
|
@ -66,9 +66,9 @@ public:
|
||||
virtual int utf8locale();
|
||||
virtual unsigned utf8to_mb(const char *src, unsigned srclen, char *dst, unsigned dstlen);
|
||||
virtual unsigned utf8from_mb(char *dst, unsigned dstlen, const char *src, unsigned srclen);
|
||||
virtual int clocale_printf(FILE *output, const char *format, va_list args);
|
||||
virtual int clocale_snprintf(char *output, size_t output_size, const char *format, va_list args);
|
||||
virtual int clocale_sscanf(const char *input, const char *format, va_list args);
|
||||
virtual int clocale_vprintf(FILE *output, const char *format, va_list args);
|
||||
virtual int clocale_vsnprintf(char *output, size_t output_size, const char *format, va_list args);
|
||||
virtual int clocale_vsscanf(const char *input, const char *format, va_list args);
|
||||
// these 2 are in Fl_get_key_win32.cxx
|
||||
virtual int event_key(int k);
|
||||
virtual int get_key(int k);
|
||||
|
@ -450,7 +450,7 @@ unsigned Fl_WinAPI_System_Driver::utf8from_mb(char *dst, unsigned dstlen, const
|
||||
static _locale_t c_locale = NULL;
|
||||
#endif
|
||||
|
||||
int Fl_WinAPI_System_Driver::clocale_printf(FILE *output, const char *format, va_list args) {
|
||||
int Fl_WinAPI_System_Driver::clocale_vprintf(FILE *output, const char *format, va_list args) {
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 /*Visual Studio 2005*/)
|
||||
if (!c_locale)
|
||||
c_locale = _create_locale(LC_NUMERIC, "C");
|
||||
@ -464,7 +464,7 @@ int Fl_WinAPI_System_Driver::clocale_printf(FILE *output, const char *format, va
|
||||
return retval;
|
||||
}
|
||||
|
||||
int Fl_WinAPI_System_Driver::clocale_snprintf(char *output, size_t output_size, const char *format, va_list args) {
|
||||
int Fl_WinAPI_System_Driver::clocale_vsnprintf(char *output, size_t output_size, const char *format, va_list args) {
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 /*Visual Studio 2005*/)
|
||||
if (!c_locale)
|
||||
c_locale = _create_locale(LC_NUMERIC, "C");
|
||||
@ -478,17 +478,11 @@ int Fl_WinAPI_System_Driver::clocale_snprintf(char *output, size_t output_size,
|
||||
return retval;
|
||||
}
|
||||
|
||||
int Fl_WinAPI_System_Driver::clocale_sscanf(const char *input, const char *format, va_list args) {
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 /*Visual Studio 2005*/)
|
||||
if (!c_locale)
|
||||
c_locale = _create_locale(LC_NUMERIC, "C");
|
||||
int retval = _vsscanf_l(input, format, c_locale, args);
|
||||
#else
|
||||
int Fl_WinAPI_System_Driver::clocale_vsscanf(const char *input, const char *format, va_list args) {
|
||||
char *saved_locale = setlocale(LC_NUMERIC, NULL);
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
int retval = vsscanf(input, format, args);
|
||||
setlocale(LC_NUMERIC, saved_locale);
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user