Fix trailing whitespace and dependencies

This commit is contained in:
Albrecht Schlosser 2023-10-13 19:08:30 +02:00
parent 6958e5d615
commit 01038e832a
25 changed files with 208 additions and 187 deletions

View File

@ -51,7 +51,7 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2022
- New Fl_ICO_Image class to read Windows .ico icon files.
- New classes Fl_SVG_File_Surface and Fl_EPS_File_Surface to save any FLTK
graphics to SVG or EPS files, respectively.
- Fl_Button now supports a compact flag that visually groups closely set
- Fl_Button now supports a compact flag that visually groups closely set
buttons into keypads.
- Fl_Tabs widget now supports close buttons for individual tabs.
- Fl_Tabs widget now supports four different modes for handling an

View File

@ -159,7 +159,7 @@ public:
*/
Fl_Window(int w, int h, const char *title = 0);
/** Creates a window from the given position (x, y), size (w, h) and title.
On a multi-screen system, the values computed by
Fl::screen_xywh(int &X, int &Y, int &W, int &H, int n) can be used to
discover the coordinates of the area of screen \#n.
@ -171,7 +171,7 @@ public:
\see Fl_Window(int w, int h, const char *title)
\see Fl::screen_xywh(int &X, int &Y, int &W, int &H, int n)
\note Under Wayland, it's generally not possible for the client app to control
the position of a window in the system. It's only possible to specify on what screen
should the compositor place a fullscreen window.

View File

@ -2,7 +2,7 @@
## WHAT IS FLTK?
The Fast Light Tool Kit is a cross-platform C++ GUI toolkit for
The Fast Light Tool Kit is a cross-platform C++ GUI toolkit for
UNIX®/Linux® (X11 or Wayland), Microsoft® Windows®, and macOS®.
FLTK provides modern GUI functionality without the bloat and
supports 3D graphics via OpenGL® and its built-in GLUT

View File

@ -3,10 +3,10 @@ README - Fast Light Tool Kit (FLTK) Version 1.4.0
WHAT IS FLTK?
The Fast Light Tool Kit is a cross-platform C++ GUI toolkit for
UNIX(r)/Linux(r) (X11 or Wayland), Microsoft(r) Windows(r), and
macOS(r). FLTK provides modern GUI functionality without the bloat
and supports 3D graphics via OpenGL(r) and its built-in GLUT
The Fast Light Tool Kit is a cross-platform C++ GUI toolkit for
UNIX(r)/Linux(r) (X11 or Wayland), Microsoft(r) Windows(r), and
macOS(r). FLTK provides modern GUI functionality without the bloat
and supports 3D graphics via OpenGL(r) and its built-in GLUT
emulation. It was originally developed by Mr. Bill Spitzak and is
currently maintained by a small group of developers across
the world with a central repository in the US.

View File

@ -1054,7 +1054,7 @@ AS_CASE([$host_os_gui], [cygwin* | mingw*], [
DSOFLAGS="$LIBS $DSOFLAGS"
enable_pango=yes
LIBDECORDIR="libdecor/build"
AS_IF([$PKGCONFIG --exists dbus-1],
AS_IF([$PKGCONFIG --exists dbus-1],
[LIBDECORDBUS="-DHAS_DBUS $($PKGCONFIG --cflags dbus-1)" LIBS="$LIBS $($PKGCONFIG --libs dbus-1)"]
)
LDFLAGS="$LDFLAGS -rdynamic"
@ -1774,7 +1774,7 @@ AS_IF([test x$enable_fluid != xno], [
],[
echo " Build fluid: NO"
])
dnl
echo "Cross-compiling: $fltk_cross_compiling"
AS_IF([test "$fltk_cross_compiling" = "yes"], [

View File

@ -40,7 +40,7 @@ void comment_cb(class Fl_Text_Editor* i, void *v);
class Fl_Widget_Type : public Fl_Type
{
typedef Fl_Type super;
virtual Fl_Widget *widget(int,int,int,int) = 0;
virtual Fl_Widget_Type *_make() = 0; // virtual constructor
void setlabel(const char *) FL_OVERRIDE;
@ -59,7 +59,7 @@ protected:
/// set, so we need a second place to store this information while also
/// disabeling the output of the "hide" property by the Widget Type.
uchar override_visible_;
void write_static(Fd_Code_Writer& f) FL_OVERRIDE;
void write_code1(Fd_Code_Writer& f) FL_OVERRIDE;
void write_widget_code(Fd_Code_Writer& f);

View File

@ -462,7 +462,7 @@ static void cb_2(Fl_Button*, void* v) {
old_name.append(g_layout_list[g_layout_list.current_suite()].name_);
const char *new_name = fl_input("Enter a name for the new layout:", old_name.c_str());
if (new_name == NULL)
return;
return;
g_layout_list.add(new_name);
g_layout_list.update_dialogs();
@ -492,7 +492,7 @@ static void cb_w_layout_menu_rename(Fl_Menu_*, void*) {
Fl_String old_name = g_layout_list[g_layout_list.current_suite()].name_;
const char *new_name = fl_input("Enter a new name for the layout:", old_name.c_str());
if (new_name == NULL)
return;
return;
g_layout_list.rename(new_name);
g_layout_list.update_dialogs();
@ -930,12 +930,12 @@ static void cb_w_settings_shell_remove(Fl_Button* o, void* v) {
Fl_Menu_Button *w_settings_shell_menu=(Fl_Menu_Button *)0;
static void cb_Import(Fl_Menu_*, void* v) {
if (v != LOAD)
if (v != LOAD)
Fd_Shell_Command_List::import_from_file();
}
static void cb_Export(Fl_Menu_*, void* v) {
if (v != LOAD)
if (v != LOAD)
Fd_Shell_Command_List::export_selected();
}
@ -993,7 +993,7 @@ static void cb_Name(Fl_Input* o, void* v) {
if (selected) {
Fd_Shell_Command *cmd = g_shell_config->list[selected-1];
cmd->name = o->value();
w_settings_shell_list->text(selected, o->value());
w_settings_shell_list->text(selected, o->value());
if (cmd->storage == FD_STORE_PROJECT) set_modflag(1);
}
}
@ -1055,7 +1055,7 @@ static void cb_Store(Fl_Choice* o, void* v) {
Fd_Tool_Store ts = (Fd_Tool_Store)(o->mvalue()->argument());
if (cmd->storage == FD_STORE_PROJECT) set_modflag(1);
cmd->storage = ts;
//w_settings_shell_list->text(selected, cmd->name.c_str());
//w_settings_shell_list->text(selected, cmd->name.c_str());
if (cmd->storage == FD_STORE_USER)
w_settings_shell_list->icon(selected, w_settings_shell_fd_user->image());
else if (cmd->storage == FD_STORE_PROJECT)

View File

@ -423,7 +423,7 @@ Fl_String old_name = "Copy of ";
old_name.append(g_layout_list[g_layout_list.current_suite()].name_);
const char *new_name = fl_input("Enter a name for the new layout:", old_name.c_str());
if (new_name == NULL)
return;
return;
g_layout_list.add(new_name);
g_layout_list.update_dialogs();}
@ -452,7 +452,7 @@ g_layout_list.update_dialogs();}
Fl_String old_name = g_layout_list[g_layout_list.current_suite()].name_;
const char *new_name = fl_input("Enter a new name for the layout:", old_name.c_str());
if (new_name == NULL)
return;
return;
g_layout_list.rename(new_name);
g_layout_list.update_dialogs();}
@ -841,8 +841,8 @@ g_layout_list.update_dialogs();}
xywh {10 90 320 132}
} {
Fl_Browser w_settings_shell_list {
label {Shell
command
label {Shell
command
list:}
callback {if (v == LOAD) {
// load from g_shell_config
@ -957,13 +957,13 @@ if (v==LOAD) {
} {
MenuItem {} {
label {Import...}
callback {if (v != LOAD)
callback {if (v != LOAD)
Fd_Shell_Command_List::import_from_file();}
tooltip {import shell commands from an external file} xywh {90 90 100 20} labelsize 11
}
MenuItem {} {
label {Export selected...}
callback {if (v != LOAD)
callback {if (v != LOAD)
Fd_Shell_Command_List::export_selected();}
tooltip {export selected shell commands to an external file} xywh {10 10 100 20} labelsize 11
}
@ -1034,7 +1034,7 @@ if (v == LOAD) {
if (selected) {
Fd_Shell_Command *cmd = g_shell_config->list[selected-1];
cmd->name = o->value();
w_settings_shell_list->text(selected, o->value());
w_settings_shell_list->text(selected, o->value());
if (cmd->storage == FD_STORE_PROJECT) set_modflag(1);
}
}}
@ -1101,7 +1101,7 @@ if (v == LOAD) {
Fd_Tool_Store ts = (Fd_Tool_Store)(o->mvalue()->argument());
if (cmd->storage == FD_STORE_PROJECT) set_modflag(1);
cmd->storage = ts;
//w_settings_shell_list->text(selected, cmd->name.c_str());
//w_settings_shell_list->text(selected, cmd->name.c_str());
if (cmd->storage == FD_STORE_USER)
w_settings_shell_list->icon(selected, w_settings_shell_fd_user->image());
else if (cmd->storage == FD_STORE_PROJECT)

View File

@ -72,7 +72,7 @@
default shell is in $SHELL on linux and macOS
On macOS, we can write Apple Scripts:
#!/usr/bin/env osascript
say "@BASENAME@"

View File

@ -29,7 +29,7 @@ static char *sv_design_filename = NULL;
/**
Update the header and source code highlighting depending on the
currently selected object
The Source View system offers an immediate preview of the code
files that will be generated by FLUID. It also marks the code
generated for the last selected item in the header and the source

View File

@ -54,7 +54,7 @@ static int num_timers = 0; // DEBUG
may wrap around and does not represent a real time (maybe runtime of the system).
Function seconds_since() below uses this to subtract two timestamps which is
always a correct delta time with milliseconds or microseconds resolution.
\param offset optional signed offset in seconds added to the current time
\return this moment in time offset by \p offset as an opaque time stamp

View File

@ -106,11 +106,11 @@ static int im_enabled = -1;
#pragma clang diagnostic ignored "-Wunguarded-availability"
static NSString *TIFF_pasteboard_type = (fl_mac_os_version >= 100600 ? NSPasteboardTypeTIFF :
NSTIFFPboardType);
static NSString *PDF_pasteboard_type = (fl_mac_os_version >= 100600 ? NSPasteboardTypePDF :
static NSString *PDF_pasteboard_type = (fl_mac_os_version >= 100600 ? NSPasteboardTypePDF :
NSPDFPboardType);
static NSString *PICT_pasteboard_type = (fl_mac_os_version >= 100600 ? @"com.apple.pict" :
static NSString *PICT_pasteboard_type = (fl_mac_os_version >= 100600 ? @"com.apple.pict" :
NSPICTPboardType);
static NSString *UTF8_pasteboard_type = (fl_mac_os_version >= 100600 ? NSPasteboardTypeString :
static NSString *UTF8_pasteboard_type = (fl_mac_os_version >= 100600 ? NSPasteboardTypeString :
NSStringPboardType);
static NSString *fl_filenames_pboard_type =
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13
@ -493,9 +493,9 @@ void Fl_Darwin_System_Driver::remove_fd(int n)
int Fl_Darwin_System_Driver::ready()
{
NSEvent *retval = [NSApp nextEventMatchingMask:NSEventMaskAny
NSEvent *retval = [NSApp nextEventMatchingMask:NSEventMaskAny
untilDate:[NSDate dateWithTimeIntervalSinceNow:0]
inMode:NSDefaultRunLoopMode
inMode:NSDefaultRunLoopMode
dequeue:NO];
return retval != nil;
}
@ -528,10 +528,10 @@ static void processFLTKEvent(void) {
*/
void Fl_Cocoa_Screen_Driver::breakMacEventLoop()
{
NSEvent *event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined
NSEvent *event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined
location:NSMakePoint(0,0)
modifierFlags:0 timestamp:0
windowNumber:0 context:NULL
windowNumber:0 context:NULL
subtype:FLTKTimerEvent
data1:0
data2:0];
@ -1064,13 +1064,13 @@ static void cocoaMouseHandler(NSEvent *theEvent)
int sendEvent = 0;
NSEventType etype = [theEvent type];
if (etype == NSEventTypeLeftMouseDown || etype == NSEventTypeRightMouseDown ||
if (etype == NSEventTypeLeftMouseDown || etype == NSEventTypeRightMouseDown ||
etype == NSEventTypeOtherMouseDown) {
if (btn == 1) Fl::e_state |= FL_BUTTON1;
else if (btn == 3) Fl::e_state |= FL_BUTTON2;
else if (btn == 2) Fl::e_state |= FL_BUTTON3;
}
else if (etype == NSEventTypeLeftMouseUp || etype == NSEventTypeRightMouseUp ||
else if (etype == NSEventTypeLeftMouseUp || etype == NSEventTypeRightMouseUp ||
etype == NSEventTypeOtherMouseUp) {
if (btn == 1) Fl::e_state &= ~FL_BUTTON1;
else if (btn == 3) Fl::e_state &= ~FL_BUTTON2;
@ -1809,7 +1809,7 @@ void Fl_Cocoa_Screen_Driver::open_display_platform() {
[NSApp finishLaunching];
// Unbundled app may require this so delegate receives applicationDidFinishLaunching:
// even if doc states this is sent at the end of finishLaunching.
if (!is_bundled()) [NSApp nextEventMatchingMask:NSEventMaskAny
if (!is_bundled()) [NSApp nextEventMatchingMask:NSEventMaskAny
untilDate:nil
inMode:NSDefaultRunLoopMode
dequeue:NO];
@ -2639,10 +2639,10 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
} else
#endif
{
CFArrayRef files = (CFArrayRef)[pboard
CFArrayRef files = (CFArrayRef)[pboard
propertyListForType:fl_filenames_pboard_type];
CFStringRef all = CFStringCreateByCombiningStrings(NULL, files, CFSTR("\n"));
int l = (int)CFStringGetMaximumSizeForEncoding(CFStringGetLength(all),
int l = (int)CFStringGetMaximumSizeForEncoding(CFStringGetLength(all),
kCFStringEncodingUTF8);
DragData = (char *)malloc(l + 1);
CFStringGetCString(all, DragData, l + 1, kCFStringEncodingUTF8);
@ -3065,7 +3065,7 @@ void Fl_Cocoa_Window_Driver::makeWindow()
[cw setFrameOrigin:crect.origin];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12
if (fl_mac_os_version >= 101200) {
if (!w->parent() && (winstyle & NSWindowStyleMaskTitled) &&
if (!w->parent() && (winstyle & NSWindowStyleMaskTitled) &&
(winstyle & NSWindowStyleMaskResizable) && !w->modal() && !w->non_modal() &&
(Fl_MacOS_Sys_Menu_Bar_Driver::window_menu_style() > Fl_Sys_Menu_Bar::tabbing_mode_none)) {
if (Fl_MacOS_Sys_Menu_Bar_Driver::window_menu_style() == Fl_Sys_Menu_Bar::tabbing_mode_preferred)
@ -3132,7 +3132,7 @@ void Fl_Cocoa_Window_Driver::makeWindow()
[cw setAlphaValue:0.97];
}
// Install DnD handlers
[myview registerForDraggedTypes:[NSArray arrayWithObjects:UTF8_pasteboard_type,
[myview registerForDraggedTypes:[NSArray arrayWithObjects:UTF8_pasteboard_type,
fl_filenames_pboard_type, nil]];
if (size_range_set()) size_range();
@ -3241,7 +3241,7 @@ static void restore_window_title_and_icon(Fl_Window *pWindow, NSImage *icon) {
FLWindow *nswin = fl_xid(pWindow);
q_set_window_title(nswin, pWindow->label(), pWindow->iconlabel());
if (!icon) icon = ((Fl_Cocoa_Screen_Driver*)Fl::screen_driver())->default_icon;
if (icon && ([nswin styleMask] & NSWindowStyleMaskTitled) && pWindow->label() &&
if (icon && ([nswin styleMask] & NSWindowStyleMaskTitled) && pWindow->label() &&
(strlen(pWindow->label()) > 0)) {
NSButton *icon_button = [nswin standardWindowButton:NSWindowDocumentIconButton];
if (icon_button) {
@ -3780,7 +3780,7 @@ static NSImage *CGBitmapContextToNSImage(CGContextRef c)
else
#endif
{
NSBitmapImageRep *imagerep =
NSBitmapImageRep *imagerep =
[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
pixelsWide:CGBitmapContextGetWidth(c)
pixelsHigh:CGBitmapContextGetHeight(c)
@ -3791,9 +3791,9 @@ static NSImage *CGBitmapContextToNSImage(CGContextRef c)
colorSpaceName:NSDeviceRGBColorSpace
bytesPerRow:CGBitmapContextGetBytesPerRow(c)
bitsPerPixel:CGBitmapContextGetBitsPerPixel(c)];
memcpy([imagerep bitmapData], CGBitmapContextGetData(c),
memcpy([imagerep bitmapData], CGBitmapContextGetData(c),
[imagerep bytesPerRow] * [imagerep pixelsHigh]);
image = [[NSImage alloc] initWithSize:NSMakeSize([imagerep pixelsWide],
image = [[NSImage alloc] initWithSize:NSMakeSize([imagerep pixelsWide],
[imagerep pixelsHigh])];
[image addRepresentation:imagerep];
[imagerep release];
@ -4030,7 +4030,7 @@ static void createAppleMenu(void)
// Show All
[appleMenu addItemWithTitle:NSLocalizedString(
[NSString stringWithUTF8String:Fl_Mac_App_Menu::show], nil)
action:@selector(unhideAllApplications:)
action:@selector(unhideAllApplications:)
keyEquivalent:@""];
[appleMenu addItem:[NSMenuItem separatorItem]];
// Quit AppName
@ -4227,7 +4227,7 @@ static NSBitmapImageRep *scale_nsbitmapimagerep(NSBitmapImageRep *img, float sca
colorSpaceName:NSDeviceRGBColorSpace
bytesPerRow:scaled_w*4
bitsPerPixel:32];
NSDictionary *dict =
NSDictionary *dict =
[NSDictionary dictionaryWithObject:scaled
forKey:NSGraphicsContextDestinationAttributeName];
NSGraphicsContext *oldgc = [NSGraphicsContext currentContext];
@ -4251,7 +4251,7 @@ static void write_bitmap_inside(NSBitmapImageRep *to, int to_width, NSBitmapImag
const uchar *from_data = [from bitmapData];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
if (fl_mac_os_version >= 100400) { // 10.4 required by the bitmapFormat message
if (([to bitmapFormat] & NSBitmapFormatAlphaFirst) &&
if (([to bitmapFormat] & NSBitmapFormatAlphaFirst) &&
!([from bitmapFormat] & NSBitmapFormatAlphaFirst) ) {
// "to" is ARGB and "from" is RGBA --> convert "from" to ARGB
// it is enough to read "from" starting one byte earlier, because A is always 0xFF:
@ -4367,7 +4367,7 @@ static NSBitmapImageRep* rect_to_NSBitmapImageRep(Fl_Window *win, int x, int y,
// lock focus to win's view
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
if (fl_mac_os_version >= 101100) {
NSGraphicsContext *ctxt = [fl_xid(win)
NSGraphicsContext *ctxt = [fl_xid(win)
performSelector:@selector(graphicsContext)];
[ctxt saveGraphicsState]; // necessary under 10.11
}
@ -4384,7 +4384,7 @@ static NSBitmapImageRep* rect_to_NSBitmapImageRep(Fl_Window *win, int x, int y,
[winview performSelector:@selector(unlockFocus)];
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
if (fl_mac_os_version >= 101100) {
NSGraphicsContext *ctxt = [fl_xid(win)
NSGraphicsContext *ctxt = [fl_xid(win)
performSelector:@selector(graphicsContext)];
[ctxt restoreGraphicsState];
}
@ -4419,7 +4419,7 @@ static NSBitmapImageRep* rect_to_NSBitmapImageRep_subwins(Fl_Window *win, int x,
win->h() - clip.origin.y - sub->y() - clip.size.height, clip.size.width, clip.size.height, true);
if (childbitmap) {
// if bitmap is high res and childbitmap is not, childbitmap must be rescaled
if (!win->as_gl_window() && Fl_Cocoa_Window_Driver::driver(win)->mapped_to_retina() &&
if (!win->as_gl_window() && Fl_Cocoa_Window_Driver::driver(win)->mapped_to_retina() &&
sub->as_gl_window() && !Fl::use_high_res_GL()) {
childbitmap = scale_nsbitmapimagerep(childbitmap, 2);
}
@ -4452,11 +4452,11 @@ CGImageRef Fl_Cocoa_Window_Driver::CGImage_from_window_rect(int x, int y, int w,
[bitmap release];
} else {
CGColorSpaceRef cspace = CGColorSpaceCreateDeviceRGB();
CGDataProviderRef provider =
CGDataProviderRef provider =
CGDataProviderCreateWithData(bitmap, [bitmap bitmapData],
[bitmap bytesPerRow] * [bitmap pixelsHigh],
nsbitmapProviderReleaseData);
img = CGImageCreate([bitmap pixelsWide], [bitmap pixelsHigh], 8, [bitmap bitsPerPixel],
img = CGImageCreate([bitmap pixelsWide], [bitmap pixelsHigh], 8, [bitmap bitsPerPixel],
[bitmap bytesPerRow], cspace,
([bitmap bitsPerPixel] == 32 ? kCGImageAlphaPremultipliedLast :
kCGImageAlphaNone) ,
@ -4622,8 +4622,8 @@ static NSImage* rgb_to_nsimage(const Fl_RGB_Image *rgb) {
NSImage *win_icon = nil;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
if (fl_mac_os_version >= 101000) {
NSBitmapImageRep *bitmap =
[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
NSBitmapImageRep *bitmap =
[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
pixelsWide:rgb->data_w()
pixelsHigh:rgb->data_h()
bitsPerSample:8

View File

@ -68,7 +68,7 @@ static EGLConfig wld_egl_conf = NULL;
EGLDisplay Fl_Wayland_Gl_Window_Driver::egl_display = EGL_NO_DISPLAY;
Fl_Wayland_Gl_Window_Driver::Fl_Wayland_Gl_Window_Driver(Fl_Gl_Window *win) :
Fl_Wayland_Gl_Window_Driver::Fl_Wayland_Gl_Window_Driver(Fl_Gl_Window *win) :
Fl_Gl_Window_Driver(win) {
if (egl_display == EGL_NO_DISPLAY) init();
egl_window = NULL;
@ -104,7 +104,7 @@ void Fl_Wayland_Gl_Window_Driver::init() {
}
char *Fl_Wayland_Gl_Window_Driver::alpha_mask_for_string(const char *str, int n,
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
@ -181,7 +181,7 @@ GLContext Fl_Wayland_Gl_Window_Driver::create_gl_context(Fl_Window* window,
if (context_list && nContext) shared_ctx = context_list[0];
static const EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
GLContext ctx = (GLContext)eglCreateContext(egl_display,
GLContext ctx = (GLContext)eglCreateContext(egl_display,
((Fl_Wayland_Gl_Choice*)g)->egl_conf,
(shared_ctx ? (EGLContext)shared_ctx : EGL_NO_CONTEXT),
context_attribs);
@ -211,7 +211,7 @@ void Fl_Wayland_Gl_Window_Driver::set_gl_context(Fl_Window* w, GLContext context
float s = Fl::screen_scale(w->screen_num());
Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
// the GL scene will be a transparent subsurface above the cairo-drawn surface
dr->gl_start_support_->surface =
dr->gl_start_support_->surface =
wl_compositor_create_surface(scr_driver->wl_compositor);
dr->gl_start_support_->subsurface = wl_subcompositor_get_subsurface(
scr_driver->wl_subcompositor, dr->gl_start_support_->surface, win->wl_surface);
@ -225,7 +225,7 @@ void Fl_Wayland_Gl_Window_Driver::set_gl_context(Fl_Window* w, GLContext context
if (context != cached_context || w != cached_window) {
cached_context = context;
cached_window = w;
if (eglMakeCurrent(egl_display, target_egl_surface, target_egl_surface,
if (eglMakeCurrent(egl_display, target_egl_surface, target_egl_surface,
(EGLContext)context)) {
//fprintf(stderr, "EGLContext %p made current\n", context);
} else {
@ -369,7 +369,7 @@ public:
}
}
void destroy(struct gl_start_support *gl_start_support_) FL_OVERRIDE {
eglDestroySurface(Fl_Wayland_Gl_Window_Driver::egl_display,
eglDestroySurface(Fl_Wayland_Gl_Window_Driver::egl_display,
gl_start_support_->egl_surface);
wl_egl_window_destroy(gl_start_support_->egl_window);
wl_subsurface_destroy(gl_start_support_->subsurface);

View File

@ -53,13 +53,13 @@ public:
struct wl_list buffers; // to list of fl_wld_buffer's from this pool
};
static const uint32_t wld_format;
void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen osrc,
void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen osrc,
int srcx, int srcy) FL_OVERRIDE;
static struct wld_buffer *create_wld_buffer(int width, int height, bool with_shm = true);
static void create_shm_buffer(wld_buffer *buffer);
static void buffer_release(struct wld_window *window);
static void buffer_commit(struct wld_window *window, struct flCairoRegion *r = NULL);
static void cairo_init(struct draw_buffer *buffer, int width, int height, int stride,
static void cairo_init(struct draw_buffer *buffer, int width, int height, int stride,
cairo_format_t format);
static struct draw_buffer *offscreen_buffer(Fl_Offscreen);
static const cairo_user_data_key_t key;

View File

@ -62,7 +62,7 @@ void Fl_Wayland_Graphics_Driver::create_shm_buffer(Fl_Wayland_Graphics_Driver::w
if (pool && !wl_list_empty(&pool_data->buffers)) {
// last wld_buffer created from current pool
struct wld_buffer *record = wl_container_of(pool_data->buffers.next, record, link);
chunk_offset = ((char*)record->data - pool_data->pool_memory) +
chunk_offset = ((char*)record->data - pool_data->pool_memory) +
record->draw_buffer.data_size;
}
if (!pool || chunk_offset + buffer->draw_buffer.data_size > pool_size) {
@ -168,7 +168,7 @@ void Fl_Wayland_Graphics_Driver::buffer_commit(struct wld_window *window, struct
cairo_surface_flush(surf);
if (r) copy_region(window, r);
else {
memcpy(window->buffer->data, window->buffer->draw_buffer.buffer,
memcpy(window->buffer->data, window->buffer->draw_buffer.buffer,
window->buffer->draw_buffer.data_size);
wl_surface_damage_buffer(window->wl_surface, 0, 0, 1000000, 1000000);
}
@ -249,7 +249,7 @@ void Fl_Wayland_Graphics_Driver::buffer_release(struct wld_window *window)
const uint32_t Fl_Wayland_Graphics_Driver::wld_format = WL_SHM_FORMAT_ARGB8888;
void Fl_Wayland_Graphics_Driver::copy_offscreen(int x, int y, int w, int h,
void Fl_Wayland_Graphics_Driver::copy_offscreen(int x, int y, int w, int h,
Fl_Offscreen src, int srcx, int srcy) {
// draw portion srcx,srcy,w,h of osrc to position x,y (top-left) of
// the graphics driver's surface

View File

@ -20,7 +20,7 @@
#include "Fl_Wayland_Image_Surface_Driver.H"
Fl_Wayland_Image_Surface_Driver::Fl_Wayland_Image_Surface_Driver(int w, int h,
Fl_Wayland_Image_Surface_Driver::Fl_Wayland_Image_Surface_Driver(int w, int h,
int high_res, Fl_Offscreen off) : Fl_Image_Surface_Driver(w, h, high_res, off) {
float d = 1;
if (!off) {
@ -90,7 +90,7 @@ void Fl_Wayland_Image_Surface_Driver::untranslate() {
Fl_RGB_Image* Fl_Wayland_Image_Surface_Driver::image() {
// Convert depth-4 image in draw_buffer to a depth-3 image while exchanging R and B colors
struct Fl_Wayland_Graphics_Driver::draw_buffer *off_buf =
struct Fl_Wayland_Graphics_Driver::draw_buffer *off_buf =
Fl_Wayland_Graphics_Driver::offscreen_buffer(offscreen);
int height = off_buf->data_size / off_buf->stride;
uchar *rgb = new uchar[off_buf->width * height * 3];

View File

@ -146,7 +146,7 @@ public:
int dnd(int unused) FL_OVERRIDE;
int compose(int &del) FL_OVERRIDE;
void compose_reset() FL_OVERRIDE;
Fl_RGB_Image *read_win_rectangle(int X, int Y, int w, int h, Fl_Window *win,
Fl_RGB_Image *read_win_rectangle(int X, int Y, int w, int h, Fl_Window *win,
bool may_capture_subwins, bool *did_capture_subwins) FL_OVERRIDE;
int get_mouse(int &x, int &y) FL_OVERRIDE;
void open_display_platform() FL_OVERRIDE;
@ -169,7 +169,7 @@ public:
int get_key(int k) FL_OVERRIDE;
void enable_im() FL_OVERRIDE;
void disable_im() FL_OVERRIDE;
// overridden functions from parent class Fl_Unix_Screen_Driver
int poll_or_select_with_delay(double time_to_wait) FL_OVERRIDE;
int poll_or_select() FL_OVERRIDE;

View File

@ -82,7 +82,7 @@ struct pointer_output {
static Fl_Int_Vector key_vector; // used by Fl_Wayland_Screen_Driver::event_key()
Fl_Wayland_Screen_Driver::compositor_name Fl_Wayland_Screen_Driver::compositor =
Fl_Wayland_Screen_Driver::compositor_name Fl_Wayland_Screen_Driver::compositor =
Fl_Wayland_Screen_Driver::unspecified;
@ -111,7 +111,7 @@ extern const char *fl_bg2;
// end of extern additions workaround
static void do_set_cursor(struct Fl_Wayland_Screen_Driver::seat *seat,
static void do_set_cursor(struct Fl_Wayland_Screen_Driver::seat *seat,
struct wl_cursor *wl_cursor = NULL) {
struct wl_cursor_image *image;
struct wl_buffer *buffer;
@ -195,9 +195,9 @@ static void pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t se
Fl_Window *win = event_coords_from_surface(surface, surface_x, surface_y);
if (!win) return;
// use custom cursor if present
struct wl_cursor *cursor =
struct wl_cursor *cursor =
fl_wl_xid(win)->custom_cursor ? fl_wl_xid(win)->custom_cursor->wl_cursor : NULL;
struct Fl_Wayland_Screen_Driver::seat *seat =
struct Fl_Wayland_Screen_Driver::seat *seat =
(struct Fl_Wayland_Screen_Driver::seat*)data;
do_set_cursor(seat, cursor);
seat->serial = serial;
@ -249,7 +249,7 @@ static void pointer_button(void *data,
uint32_t button,
uint32_t state)
{
struct Fl_Wayland_Screen_Driver::seat *seat =
struct Fl_Wayland_Screen_Driver::seat *seat =
(struct Fl_Wayland_Screen_Driver::seat*)data;
seat->serial = serial;
int event = 0;
@ -257,7 +257,7 @@ static void pointer_button(void *data,
if (!win) return;
win = win->top_window();
wld_event_time = time;
if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED &&
if (button == BTN_LEFT && state == WL_POINTER_BUTTON_STATE_PRESSED &&
seat->pointer_focus == NULL &&
(fl_wl_xid(win))->kind == Fl_Wayland_Window_Driver::DECORATED) {
// click on titlebar
@ -367,7 +367,7 @@ static void output_scale(void *data, struct wl_output *wl_output, int32_t factor
static void cursor_surface_enter(void *data,
struct wl_surface *wl_surface, struct wl_output *wl_output) {
// Runs when the seat's cursor_surface enters a display
struct Fl_Wayland_Screen_Driver::seat *seat =
struct Fl_Wayland_Screen_Driver::seat *seat =
(struct Fl_Wayland_Screen_Driver::seat*)data;
struct pointer_output *pointer_output;
@ -375,12 +375,12 @@ static void cursor_surface_enter(void *data,
return;
pointer_output = (struct pointer_output *)calloc(1, sizeof(struct pointer_output));
pointer_output->output =
pointer_output->output =
(Fl_Wayland_Screen_Driver::output *)wl_output_get_user_data(wl_output);
//fprintf(stderr, "cursor_surface_enter: wl_output_get_user_data(%p)=%p\n", wl_output, pointer_output->output);
wl_list_insert(&seat->pointer_outputs, &pointer_output->link);
try_update_cursor(seat);
Fl_Wayland_Screen_Driver::output *output =
Fl_Wayland_Screen_Driver::output *output =
(Fl_Wayland_Screen_Driver::output*)wl_output_get_user_data(wl_output);
output_scale(output, wl_output, output->wld_scale); // rescale custom cursors
// maintain custom or standard window cursor
@ -457,7 +457,7 @@ static void init_cursors(struct Fl_Wayland_Screen_Driver::seat *seat) {
static void wl_keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
uint32_t format, int32_t fd, uint32_t size) {
struct Fl_Wayland_Screen_Driver::seat *seat =
struct Fl_Wayland_Screen_Driver::seat *seat =
(struct Fl_Wayland_Screen_Driver::seat*)data;
assert(format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1);
@ -552,10 +552,10 @@ struct key_repeat_data_t {
static void key_repeat_timer_cb(key_repeat_data_t *key_repeat_data) {
if ((Fl::event() == FL_KEYDOWN || (Fl_Window_Driver::menu_parent() &&
if ((Fl::event() == FL_KEYDOWN || (Fl_Window_Driver::menu_parent() &&
Fl::event() == FL_ENTER)) && wld_event_time == key_repeat_data->time) {
Fl::handle(FL_KEYDOWN, key_repeat_data->window);
Fl::add_timeout(KEY_REPEAT_INTERVAL, (Fl_Timeout_Handler)key_repeat_timer_cb,
Fl::add_timeout(KEY_REPEAT_INTERVAL, (Fl_Timeout_Handler)key_repeat_timer_cb,
key_repeat_data);
}
else delete key_repeat_data;
@ -596,7 +596,7 @@ void Fl_Wayland_Screen_Driver::insertion_point_location(int x, int y, int height
insertion_point_width = s*5;
insertion_point_height = s*height;
if (zwp_text_input_v3_get_user_data(scr_driver->seat->text_input) ) {
zwp_text_input_v3_set_cursor_rectangle(scr_driver->seat->text_input,
zwp_text_input_v3_set_cursor_rectangle(scr_driver->seat->text_input,
insertion_point_x, insertion_point_y,
insertion_point_width, insertion_point_height);
zwp_text_input_v3_commit(scr_driver->seat->text_input);
@ -606,7 +606,7 @@ void Fl_Wayland_Screen_Driver::insertion_point_location(int x, int y, int height
// computes window coordinates & size of insertion point
bool Fl_Wayland_Screen_Driver::insertion_point_location(int *px, int *py,
bool Fl_Wayland_Screen_Driver::insertion_point_location(int *px, int *py,
int *pwidth, int *pheight) {
// return true if the current coordinates and size of the insertion point are available
if ( ! insertion_point_location_is_valid ) return false;
@ -733,19 +733,19 @@ fprintf(stderr, "key %s: sym: %-12s(%d) code:%u fl_win=%p, ", action, buf, sym,
int event = (state == WL_KEYBOARD_KEY_STATE_PRESSED ? FL_KEYDOWN : FL_KEYUP);
// Send event to focus-containing top window as defined by FLTK,
// otherwise send it to Wayland-defined focus window
Fl_Window *win = ( Fl::focus() ? Fl::focus()->top_window() :
Fl_Window *win = ( Fl::focus() ? Fl::focus()->top_window() :
Fl_Wayland_Window_Driver::surface_to_window(seat->keyboard_surface) );
if (win) {
set_event_xy(win);
Fl::e_is_click = 0;
Fl::handle(event, win);
}
if (event == FL_KEYDOWN && status == XKB_COMPOSE_NOTHING &&
if (event == FL_KEYDOWN && status == XKB_COMPOSE_NOTHING &&
!(sym >= FL_Shift_L && sym <= FL_Alt_R)) {
key_repeat_data_t *key_repeat_data = new key_repeat_data_t;
key_repeat_data->time = time;
key_repeat_data->window = win;
Fl::add_timeout(KEY_REPEAT_DELAY, (Fl_Timeout_Handler)key_repeat_timer_cb,
Fl::add_timeout(KEY_REPEAT_DELAY, (Fl_Timeout_Handler)key_repeat_timer_cb,
key_repeat_data);
}
}
@ -769,10 +769,10 @@ static void wl_keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard,
uint32_t group) {
struct Fl_Wayland_Screen_Driver::seat *seat =
(struct Fl_Wayland_Screen_Driver::seat*)data;
xkb_state_update_mask(seat->xkb_state, mods_depressed, mods_latched, mods_locked,
xkb_state_update_mask(seat->xkb_state, mods_depressed, mods_latched, mods_locked,
0, 0, group);
Fl::e_state &= ~(FL_SHIFT+FL_CTRL+FL_ALT+FL_CAPS_LOCK+FL_NUM_LOCK);
if (xkb_state_mod_name_is_active(seat->xkb_state, XKB_MOD_NAME_SHIFT,
if (xkb_state_mod_name_is_active(seat->xkb_state, XKB_MOD_NAME_SHIFT,
XKB_STATE_MODS_DEPRESSED)) Fl::e_state |= FL_SHIFT;
if (xkb_state_mod_name_is_active(seat->xkb_state, XKB_MOD_NAME_CTRL,
XKB_STATE_MODS_DEPRESSED)) Fl::e_state |= FL_CTRL;
@ -857,7 +857,7 @@ void text_input_commit_string(void *data, struct zwp_text_input_v3 *zwp_text_inp
}
void text_input_delete_surrounding_text(void *data,
void text_input_delete_surrounding_text(void *data,
struct zwp_text_input_v3 *zwp_text_input_v3,
uint32_t before_length, uint32_t after_length) {
fprintf(stderr, "delete_surrounding_text before=%d adfter=%d\n",
@ -883,7 +883,7 @@ static const struct zwp_text_input_v3_listener text_input_listener = {
void Fl_Wayland_Screen_Driver::enable_im() {
if (text_input_base && !seat->text_input) {
seat->text_input = zwp_text_input_manager_v3_get_text_input(text_input_base,
seat->text_input = zwp_text_input_manager_v3_get_text_input(text_input_base,
seat->wl_seat);
//printf("seat->text_input=%p\n",seat->text_input);
zwp_text_input_v3_add_listener(seat->text_input, &text_input_listener, NULL);
@ -903,7 +903,7 @@ void Fl_Wayland_Screen_Driver::disable_im() {
static void seat_capabilities(void *data, struct wl_seat *wl_seat, uint32_t capabilities)
{
struct Fl_Wayland_Screen_Driver::seat *seat =
struct Fl_Wayland_Screen_Driver::seat *seat =
(struct Fl_Wayland_Screen_Driver::seat*)data;
if ((capabilities & WL_SEAT_CAPABILITY_POINTER) && !seat->wl_pointer) {
seat->wl_pointer = wl_seat_get_pointer(wl_seat);
@ -1057,15 +1057,15 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis
} else if (strcmp(interface, "wl_seat") == 0) {
if (version < 2) {
Fl::fatal("%s version 2 required but only version %i is available\n",
Fl::fatal("%s version 2 required but only version %i is available\n",
interface, version);
}
if (!scr_driver->seat) scr_driver->seat =
if (!scr_driver->seat) scr_driver->seat =
(struct Fl_Wayland_Screen_Driver::seat*)calloc(1,
sizeof(struct Fl_Wayland_Screen_Driver::seat));
//fprintf(stderr, "registry_handle_global: seat=%p\n", scr_driver->seat);
wl_list_init(&scr_driver->seat->pointer_outputs);
scr_driver->seat->wl_seat = (wl_seat*)wl_registry_bind(wl_registry, id,
scr_driver->seat->wl_seat = (wl_seat*)wl_registry_bind(wl_registry, id,
&wl_seat_interface, 2);
scr_driver->seat->xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
if (scr_driver->seat->xkb_context) {
@ -1076,7 +1076,7 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis
locale = getenv("LANG");
if (!locale || !*locale)
locale = "C";
struct xkb_compose_table *table =
struct xkb_compose_table *table =
xkb_compose_table_new_from_locale(scr_driver->seat->xkb_context, locale,
XKB_COMPOSE_COMPILE_NO_FLAGS);
if (table) {
@ -1086,36 +1086,36 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis
}
wl_seat_add_listener(scr_driver->seat->wl_seat, &seat_listener, scr_driver->seat);
if (scr_driver->seat->data_device_manager) {
scr_driver->seat->data_device =
scr_driver->seat->data_device =
wl_data_device_manager_get_data_device(scr_driver->seat->data_device_manager,
scr_driver->seat->wl_seat);
wl_data_device_add_listener(scr_driver->seat->data_device,
wl_data_device_add_listener(scr_driver->seat->data_device,
Fl_Wayland_Screen_Driver::p_data_device_listener, NULL);
}
} else if (strcmp(interface, wl_data_device_manager_interface.name) == 0) {
if (!scr_driver->seat) scr_driver->seat =
if (!scr_driver->seat) scr_driver->seat =
(struct Fl_Wayland_Screen_Driver::seat*)calloc(1,
sizeof(struct Fl_Wayland_Screen_Driver::seat));
scr_driver->seat->data_device_manager =
scr_driver->seat->data_device_manager =
(struct wl_data_device_manager*)wl_registry_bind(wl_registry, id,
&wl_data_device_manager_interface,
fl_min(version, 3));
if (scr_driver->seat->wl_seat) {
scr_driver->seat->data_device =
scr_driver->seat->data_device =
wl_data_device_manager_get_data_device(scr_driver->seat->data_device_manager,
scr_driver->seat->wl_seat);
wl_data_device_add_listener(scr_driver->seat->data_device,
wl_data_device_add_listener(scr_driver->seat->data_device,
Fl_Wayland_Screen_Driver::p_data_device_listener, NULL);
}
//fprintf(stderr, "registry_handle_global: %s\n", interface);
} else if (strcmp(interface, "wl_output") == 0) {
if (version < 2) {
Fl::fatal("%s version 2 required but only version %i is available\n",
Fl::fatal("%s version 2 required but only version %i is available\n",
interface, version);
}
Fl_Wayland_Screen_Driver::output *output =
Fl_Wayland_Screen_Driver::output *output =
(Fl_Wayland_Screen_Driver::output*)calloc(1, sizeof *output);
output->id = id;
output->wld_scale = 1;
@ -1130,7 +1130,7 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis
} else if (strcmp(interface, xdg_wm_base_interface.name) == 0) {
//fprintf(stderr, "registry_handle_global interface=%s\n", interface);
scr_driver->xdg_wm_base = (struct xdg_wm_base *)wl_registry_bind(wl_registry, id,
scr_driver->xdg_wm_base = (struct xdg_wm_base *)wl_registry_bind(wl_registry, id,
&xdg_wm_base_interface, 1);
xdg_wm_base_add_listener(scr_driver->xdg_wm_base, &xdg_wm_base_listener, NULL);
} else if (strcmp(interface, "gtk_shell1") == 0) {
@ -1146,7 +1146,7 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis
Fl_Wayland_Screen_Driver::compositor = Fl_Wayland_Screen_Driver::OWL;
//fprintf(stderr, "Running the Owl compositor\n");
if (wl_list_length(&scr_driver->outputs) == 0) {
Fl_Wayland_Screen_Driver::output *output =
Fl_Wayland_Screen_Driver::output *output =
(Fl_Wayland_Screen_Driver::output*)calloc(1, sizeof *output);
output->id = 1;
output->wld_scale = 1;
@ -1157,7 +1157,7 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis
scr_driver->screen_count_set(1);
}
} else if (strcmp(interface, zwp_text_input_manager_v3_interface.name) == 0) {
scr_driver->text_input_base = (struct zwp_text_input_manager_v3 *)
scr_driver->text_input_base = (struct zwp_text_input_manager_v3 *)
wl_registry_bind(wl_registry, id, &zwp_text_input_manager_v3_interface, 1);
//printf("scr_driver->text_input_base=%p version=%d\n",scr_driver->text_input_base,version);
}
@ -1322,7 +1322,7 @@ void Fl_Wayland_Screen_Driver::close_display() {
seat->data_source = NULL;
}
wl_data_device_destroy(seat->data_device); seat->data_device = NULL;
wl_data_device_manager_destroy(seat->data_device_manager);
wl_data_device_manager_destroy(seat->data_device_manager);
seat->data_device_manager = NULL;
wl_seat_destroy(seat->wl_seat); seat->wl_seat = NULL;
if (seat->name) free(seat->name);
@ -1503,7 +1503,7 @@ static void set_selection_color(uchar r, uchar g, uchar b)
}
static void getsyscolor(const char *key1, const char* key2, const char *arg,
static void getsyscolor(const char *key1, const char* key2, const char *arg,
const char *defarg, void (*func)(uchar,uchar,uchar)) {
uchar r, g, b;
if (!arg) arg = defarg;
@ -1530,7 +1530,7 @@ void Fl_Wayland_Screen_Driver::get_system_colors()
}
Fl_RGB_Image *Fl_Wayland_Screen_Driver::read_win_rectangle(int X, int Y, int w, int h,
Fl_RGB_Image *Fl_Wayland_Screen_Driver::read_win_rectangle(int X, int Y, int w, int h,
Fl_Window *win,
bool ignore, bool *p_ignore) {
struct wld_window* xid = win ? fl_wl_xid(win) : NULL;
@ -1709,7 +1709,7 @@ void *Fl_Wayland_Screen_Driver::control_maximize_button(void *data) {
Fl_Window *win = Fl::first_window();
while (win) {
if (!win->parent() && win->border() &&
!( ((struct wld_window*)Fl_X::flx(win)->xid)->state &
!( ((struct wld_window*)Fl_X::flx(win)->xid)->state &
LIBDECOR_WINDOW_STATE_MAXIMIZED) ) {
win_dims *dim = new win_dims;
dim->tracker = new Fl_Widget_Tracker(win);

View File

@ -124,9 +124,9 @@ public:
int set_cursor_4args(const Fl_RGB_Image*, int, int, bool);
void shape(const Fl_Image* img) FL_OVERRIDE;
void capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_RGB_Image*& left,
void capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_RGB_Image*& left,
Fl_RGB_Image*& bottom, Fl_RGB_Image*& right) FL_OVERRIDE;
int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y,
int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y,
void (*draw_area)(void*, int,int,int,int), void* data) FL_OVERRIDE;
void wait_for_expose() FL_OVERRIDE;
// menu-related stuff

View File

@ -161,7 +161,7 @@ void Fl_Wayland_Window_Driver::take_focus()
struct wld_window *first_xid = (old_first ? fl_wl_xid(old_first->top_window()) : NULL);
if (first_xid && first_xid != w && xdg_toplevel()) {
// this will move the target window to the front
Fl_Wayland_Window_Driver *top_dr =
Fl_Wayland_Window_Driver *top_dr =
Fl_Wayland_Window_Driver::driver(old_first->top_window());
xdg_toplevel_set_parent(xdg_toplevel(), top_dr->xdg_toplevel());
// this will remove the parent-child relationship
@ -245,7 +245,7 @@ void Fl_Wayland_Window_Driver::shape_alpha_(Fl_Image* img, int offset) {
alpha += d; // point to alpha value of next img pixel
}
}
cairo_surface_t *mask_surf = cairo_image_surface_create_for_data(bits, CAIRO_FORMAT_A1,
cairo_surface_t *mask_surf = cairo_image_surface_create_for_data(bits, CAIRO_FORMAT_A1,
w, h, bytesperrow);
shape_data_->mask_pattern_ = cairo_pattern_create_for_surface(mask_surf);
cairo_surface_destroy(mask_surf);
@ -303,7 +303,7 @@ void Fl_Wayland_Window_Driver::draw_end()
Returned images can be deleted after use. Their depth and size may be platform-dependent.
The top and bottom images extend from left of the left border to right of the right border.
*/
void Fl_Wayland_Window_Driver::capture_titlebar_and_borders(Fl_RGB_Image*& top,
void Fl_Wayland_Window_Driver::capture_titlebar_and_borders(Fl_RGB_Image*& top,
Fl_RGB_Image*& left, Fl_RGB_Image*& bottom, Fl_RGB_Image*& right)
{
top = left = bottom = right = NULL;
@ -494,7 +494,7 @@ void Fl_Wayland_Window_Driver::map() {
struct wld_window *parent = fl_wl_xid(pWindow->window());
if (parent) {
Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
wl_win->subsurface = wl_subcompositor_get_subsurface(scr_driver->wl_subcompositor,
wl_win->subsurface = wl_subcompositor_get_subsurface(scr_driver->wl_subcompositor,
wl_win->wl_surface, parent->wl_surface);
float f = Fl::screen_scale(pWindow->top_window()->screen_num());
wl_subsurface_set_position(wl_win->subsurface, pWindow->x() * f, pWindow->y() * f);
@ -566,7 +566,7 @@ void Fl_Wayland_Window_Driver::iconize() {
}
void Fl_Wayland_Window_Driver::decoration_sizes(int *top, int *left, int *right, int *bottom)
void Fl_Wayland_Window_Driver::decoration_sizes(int *top, int *left, int *right, int *bottom)
{
struct wld_window *xid = (struct wld_window*)fl_xid(pWindow);
if (xid && xid->kind == DECORATED) {
@ -579,7 +579,7 @@ void Fl_Wayland_Window_Driver::decoration_sizes(int *top, int *left, int *right
}
int Fl_Wayland_Window_Driver::scroll(int src_x, int src_y, int src_w, int src_h,
int Fl_Wayland_Window_Driver::scroll(int src_x, int src_y, int src_w, int src_h,
int dest_x, int dest_y,
void (*draw_area)(void*, int,int,int,int), void* data)
{
@ -678,7 +678,7 @@ static void surface_enter(void *data, struct wl_surface *wl_surface,
if (!Fl_Wayland_Screen_Driver::own_output(wl_output))
return;
Fl_Wayland_Screen_Driver::output *output =
Fl_Wayland_Screen_Driver::output *output =
(Fl_Wayland_Screen_Driver::output*)wl_output_get_user_data(wl_output);
if (output == NULL)
return;
@ -706,7 +706,7 @@ static void surface_leave(void *data, struct wl_surface *wl_surface,
if (!Fl_Wayland_Screen_Driver::own_output(wl_output))
return;
struct wld_window *window = (struct wld_window*)data;
Fl_Wayland_Screen_Driver::output *output =
Fl_Wayland_Screen_Driver::output *output =
(Fl_Wayland_Screen_Driver::output*)wl_output_get_user_data(wl_output);
Fl_Wayland_Window_Driver *win_driver = Fl_Wayland_Window_Driver::driver(window->fl_win);
float pre_scale = Fl::screen_scale(win_driver->screen_num()) * win_driver->wld_scale();
@ -832,13 +832,13 @@ static void handle_configure(struct libdecor_frame *frame,
// true exactly for the 2nd run of handle_configure() for this window
bool is_2nd_run = (window->xdg_surface != 0 && driver->wait_for_expose_value);
float f = Fl::screen_scale(window->fl_win->screen_num());
if (!window->xdg_surface) window->xdg_surface = libdecor_frame_get_xdg_surface(frame);
#ifdef LIBDECOR_MR131
if (is_1st_run) use_FLTK_toplevel_configure_cb(frame);
#endif
struct wl_output *wl_output = NULL;
if (window->fl_win->fullscreen_active()) {
if (!(window->state & LIBDECOR_WINDOW_STATE_FULLSCREEN)) {
@ -861,7 +861,7 @@ static void handle_configure(struct libdecor_frame *frame,
window->fl_win->redraw();
}
window->state = window_state;
// Weston, KWin, and some versions of Mutter, on purpose, don't set the
// window width x height when xdg_toplevel_configure runs twice
// during resizable window creation
@ -885,7 +885,7 @@ static void handle_configure(struct libdecor_frame *frame,
Fl::screen_xywh(X, Y, W, H, window->fl_win->screen_num());
width = W * f; height = H * f;
}
if (width == 0) {
width = window->floating_width;
height = window->floating_height;
@ -941,7 +941,7 @@ static void handle_configure(struct libdecor_frame *frame,
if (Fl_Wayland_Screen_Driver::compositor != Fl_Wayland_Screen_Driver::WESTON || !is_1st_run) {
window->fl_win->clear_damage();
}
if (Fl_Wayland_Screen_Driver::compositor == Fl_Wayland_Screen_Driver::OWL) {
Fl_Window *sub = Fl::first_window();
while (sub) { // search still un-exposed sub-windows
@ -962,7 +962,7 @@ void Fl_Wayland_Window_Driver::wait_for_expose()
if (!xid) return;
if (pWindow->fullscreen_active()) {
if (xid->kind == DECORATED) {
while (!(xid->state & LIBDECOR_WINDOW_STATE_FULLSCREEN) ||
while (!(xid->state & LIBDECOR_WINDOW_STATE_FULLSCREEN) ||
!(xid->state & LIBDECOR_WINDOW_STATE_ACTIVE)) {
wl_display_dispatch(Fl_Wayland_Screen_Driver::wl_display);
}
@ -1027,7 +1027,7 @@ static void xdg_surface_configure(void *data, struct xdg_surface *xdg_surface, u
xdg_surface_ack_configure(xdg_surface, serial);
//fprintf(stderr, "xdg_surface_configure: surface=%p\n", window->wl_surface);
if (window->fl_win->w() != window->configured_width ||
if (window->fl_win->w() != window->configured_width ||
window->fl_win->h() != window->configured_height) {
if (window->buffer) {
Fl_Wayland_Graphics_Driver::buffer_release(window);
@ -1068,7 +1068,7 @@ static void xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel
if (window->fl_win->fullscreen_active() && !parse_states_fullscreen(states)) {
struct wl_output *wl_output = NULL;
if (Fl_Window_Driver::driver(window->fl_win)->force_position()) {
struct Fl_Wayland_Screen_Driver::output *output =
struct Fl_Wayland_Screen_Driver::output *output =
screen_num_to_output(window->fl_win->screen_num());
if (output) wl_output = output->wl_output;
}
@ -1087,7 +1087,7 @@ static void xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel
height = window->fl_win->h() * f;
}
window->fl_win->size(ceil(width / f), ceil(height / f));
if (window->buffer && (ceil(width / f) != window->configured_width ||
if (window->buffer && (ceil(width / f) != window->configured_width ||
ceil(height / f) != window->configured_height)) {
Fl_Wayland_Graphics_Driver::buffer_release(window);
}
@ -1114,7 +1114,7 @@ struct win_positioner {
};
static void popup_configure(void *data, struct xdg_popup *xdg_popup, int32_t x, int32_t y,
static void popup_configure(void *data, struct xdg_popup *xdg_popup, int32_t x, int32_t y,
int32_t width, int32_t height) {
struct win_positioner *win_pos = (struct win_positioner *)data;
struct wld_window *window = win_pos->window;
@ -1263,14 +1263,14 @@ bool Fl_Wayland_Window_Driver::process_menu_or_tooltip(struct wld_window *new_wi
previous_floatingtitle = pWindow;
return true;
}
new_window->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base,
new_window->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base,
new_window->wl_surface);
xdg_surface_add_listener(new_window->xdg_surface, &xdg_surface_listener, new_window);
Fl_Wayland_Window_Driver::new_popup = true;
Fl_Window *menu_origin = NULL;
if (pWindow->menu_window()) {
menu_origin = Fl_Window_Driver::menu_leftorigin(pWindow);
if (!menu_origin && !previous_floatingtitle) menu_origin =
if (!menu_origin && !previous_floatingtitle) menu_origin =
Fl_Window_Driver::menu_title(pWindow);
}
Fl_Widget *target = (pWindow->tooltip_window() ? Fl_Tooltip::current() : NULL);
@ -1289,7 +1289,7 @@ bool Fl_Wayland_Window_Driver::process_menu_or_tooltip(struct wld_window *new_wi
//xdg_positioner_get_version(positioner) <== gives 1 under Debian and Sway
int popup_x, popup_y;
if (Fl_Window_Driver::menu_title(pWindow) && Fl_Window_Driver::menu_bartitle(pWindow)) {
xdg_positioner_set_anchor_rect(positioner, 0, 0,
xdg_positioner_set_anchor_rect(positioner, 0, 0,
Fl_Window_Driver::menu_title(pWindow)->w() * f,
Fl_Window_Driver::menu_title(pWindow)->h() * f);
popup_x = 0;
@ -1302,13 +1302,13 @@ bool Fl_Wayland_Window_Driver::process_menu_or_tooltip(struct wld_window *new_wi
popup_y -= menu_origin->y() * f;
}
if (popup_x >= origin_win->w() * f) popup_x = origin_win->w() * f - 1;
if (!Fl_Window_Driver::menu_title(pWindow) && !Fl_Window_Driver::menu_bartitle(pWindow) &&
if (!Fl_Window_Driver::menu_title(pWindow) && !Fl_Window_Driver::menu_bartitle(pWindow) &&
!Fl_Window_Driver::menu_leftorigin(pWindow)) {
// prevent first popup from going above the permissible source window
popup_y = fl_max(popup_y, - pWindow->h() * f);
}
if (parent_xid->kind == Fl_Wayland_Window_Driver::DECORATED)
libdecor_frame_translate_coordinate(parent_xid->frame, popup_x, popup_y,
libdecor_frame_translate_coordinate(parent_xid->frame, popup_x, popup_y,
&popup_x, &popup_y);
xdg_positioner_set_anchor_rect(positioner, popup_x, 0, 1, 1);
popup_y++;
@ -1326,7 +1326,7 @@ bool Fl_Wayland_Window_Driver::process_menu_or_tooltip(struct wld_window *new_wi
if (!(Fl_Window_Driver::menu_title(pWindow) && Fl_Window_Driver::menu_bartitle(pWindow))) {
xdg_positioner_set_offset(positioner, 0, popup_y);
}
new_window->xdg_popup = xdg_surface_get_popup(new_window->xdg_surface,
new_window->xdg_popup = xdg_surface_get_popup(new_window->xdg_surface,
parent_xdg, positioner);
struct win_positioner *win_pos = new struct win_positioner;
win_pos->window = new_window;
@ -1365,7 +1365,7 @@ void Fl_Wayland_Window_Driver::makeWindow()
new_window->wl_surface = wl_compositor_create_surface(scr_driver->wl_compositor);
//Fl::warning("makeWindow:%p wayland-scale=%d user-scale=%.2f\n", pWindow, new_window->scale, Fl::screen_scale(0));
wl_surface_add_listener(new_window->wl_surface, &surface_listener, new_window);
if (!shape()) { // rectangular FLTK windows are opaque
struct wl_region *opaque = wl_compositor_create_region(scr_driver->wl_compositor);
wl_region_add(opaque, 0, 0, 1000000, 1000000);
@ -1373,7 +1373,7 @@ void Fl_Wayland_Window_Driver::makeWindow()
wl_region_destroy(opaque);
}
if (pWindow->user_data() == &Fl_Screen_Driver::transient_scale_display &&
if (pWindow->user_data() == &Fl_Screen_Driver::transient_scale_display &&
Fl::first_window()) {
// put transient scale win at center of top window by making it a child of top
int center_x, center_y;
@ -1390,7 +1390,7 @@ void 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_Wayland_Screen_Driver::wl_display,
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);
@ -1409,7 +1409,7 @@ void Fl_Wayland_Window_Driver::makeWindow()
} else if (pWindow->parent()) { // for subwindows (GL or non-GL)
new_window->kind = SUBWINDOW;
struct wld_window *parent = fl_wl_xid(pWindow->window());
new_window->subsurface = wl_subcompositor_get_subsurface(scr_driver->wl_subcompositor,
new_window->subsurface = wl_subcompositor_get_subsurface(scr_driver->wl_subcompositor,
new_window->wl_surface,
parent->wl_surface);
//fprintf(stderr, "makeWindow: subsurface=%p\n", new_window->subsurface);
@ -1417,7 +1417,7 @@ void Fl_Wayland_Window_Driver::makeWindow()
wl_subsurface_set_position(new_window->subsurface, pWindow->x() * f, pWindow->y() * f);
wl_subsurface_set_desync(new_window->subsurface); // important
// next 3 statements ensure the subsurface will be mapped because:
// "A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
// "A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
// and the parent surface is mapped."
new_window->configured_width = pWindow->w();
new_window->configured_height = pWindow->h();
@ -1431,7 +1431,7 @@ void Fl_Wayland_Window_Driver::makeWindow()
} else { // a window without decoration
new_window->kind = UNFRAMED;
new_window->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base,
new_window->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base,
new_window->wl_surface);
//fprintf(stderr, "makeWindow: xdg_wm_base_get_xdg_surface=%p\n", new_window->xdg_surface);
xdg_surface_add_listener(new_window->xdg_surface, &xdg_surface_listener, new_window);
@ -1499,18 +1499,18 @@ void Fl_Wayland_Window_Driver::makeWindow()
struct wld_window *xid = fl_wl_xid(previous_floatingtitle);
xid->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base, xid->wl_surface);
xdg_surface_add_listener(xid->xdg_surface, &xdg_surface_listener, xid);
struct xdg_positioner *positioner =
struct xdg_positioner *positioner =
xdg_wm_base_create_positioner(scr_driver->xdg_wm_base);
xdg_positioner_set_anchor_rect(positioner, 0, 0, 1, 1);
int snum = Fl_Window_Driver::menu_parent()->screen_num();
float f = Fl::screen_scale(snum);
// put it on same screen as parent menu
Fl_Window_Driver::driver(previous_floatingtitle)->screen_num(snum);
xdg_positioner_set_size(positioner, previous_floatingtitle->w() * f ,
xdg_positioner_set_size(positioner, previous_floatingtitle->w() * f ,
previous_floatingtitle->h() * f );
xdg_positioner_set_anchor(positioner, XDG_POSITIONER_ANCHOR_TOP_LEFT);
xdg_positioner_set_gravity(positioner, XDG_POSITIONER_GRAVITY_TOP_RIGHT);
xid->xdg_popup = xdg_surface_get_popup(xid->xdg_surface, new_window->xdg_surface,
xid->xdg_popup = xdg_surface_get_popup(xid->xdg_surface, new_window->xdg_surface,
positioner);
xdg_positioner_destroy(positioner);
struct win_positioner *win_pos = new struct win_positioner;
@ -1553,7 +1553,7 @@ int Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor c) {
scr_driver->default_cursor(scr_driver->xc_arrow);
break;
case FL_CURSOR_NS:
if (!scr_driver->xc_ns) scr_driver->xc_ns =
if (!scr_driver->xc_ns) scr_driver->xc_ns =
scr_driver->cache_cursor("sb_v_double_arrow");
if (!scr_driver->xc_ns) return 0;
scr_driver->default_cursor(scr_driver->xc_ns);
@ -1591,7 +1591,7 @@ int Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor c) {
scr_driver->default_cursor(scr_driver->xc_move);
break;
case FL_CURSOR_WE:
if (!scr_driver->xc_we) scr_driver->xc_we =
if (!scr_driver->xc_we) scr_driver->xc_we =
scr_driver->cache_cursor("sb_h_double_arrow");
if (!scr_driver->xc_we) return 0;
scr_driver->default_cursor(scr_driver->xc_we);
@ -1612,31 +1612,31 @@ int Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor c) {
scr_driver->default_cursor(scr_driver->xc_west);
break;
case FL_CURSOR_S:
if (!scr_driver->xc_south) scr_driver->xc_south =
if (!scr_driver->xc_south) scr_driver->xc_south =
scr_driver->cache_cursor("bottom_side");
if (!scr_driver->xc_south) return 0;
scr_driver->default_cursor(scr_driver->xc_south);
break;
case FL_CURSOR_NESW:
if (!scr_driver->xc_nesw) scr_driver->xc_nesw =
if (!scr_driver->xc_nesw) scr_driver->xc_nesw =
scr_driver->cache_cursor("fd_double_arrow");
if (!scr_driver->xc_nesw) return 0;
scr_driver->default_cursor(scr_driver->xc_nesw);
break;
case FL_CURSOR_NWSE:
if (!scr_driver->xc_nwse) scr_driver->xc_nwse =
if (!scr_driver->xc_nwse) scr_driver->xc_nwse =
scr_driver->cache_cursor("bd_double_arrow");
if (!scr_driver->xc_nwse) return 0;
scr_driver->default_cursor(scr_driver->xc_nwse);
break;
case FL_CURSOR_SW:
if (!scr_driver->xc_sw) scr_driver->xc_sw =
if (!scr_driver->xc_sw) scr_driver->xc_sw =
scr_driver->cache_cursor("bottom_left_corner");
if (!scr_driver->xc_sw) return 0;
scr_driver->default_cursor(scr_driver->xc_sw);
break;
case FL_CURSOR_SE:
if (!scr_driver->xc_se) scr_driver->xc_se =
if (!scr_driver->xc_se) scr_driver->xc_se =
scr_driver->cache_cursor("bottom_right_corner");
if (!scr_driver->xc_se) return 0;
scr_driver->default_cursor(scr_driver->xc_se);
@ -1740,7 +1740,7 @@ int Fl_Wayland_Window_Driver::set_cursor_4args(const Fl_RGB_Image *rgb, int hotx
// build a new wl_cursor and its image
struct wld_window *xid = (struct wld_window *)Fl_Window_Driver::xid(pWindow);
struct wl_cursor *new_cursor = (struct wl_cursor*)malloc(sizeof(struct wl_cursor));
struct cursor_image *new_image = (struct cursor_image*)calloc(1,
struct cursor_image *new_image = (struct cursor_image*)calloc(1,
sizeof(struct cursor_image));
int scale = wld_scale();
new_image->image.width = rgb->w() * scale;
@ -1767,7 +1767,7 @@ int Fl_Wayland_Window_Driver::set_cursor_4args(const Fl_RGB_Image *rgb, int hotx
Fl_Surface_Device::pop_current();
delete img_surf;
memcpy(offscreen->data, offscreen->draw_buffer.buffer, offscreen->draw_buffer.data_size);
// delete the previous custom cursor, if there was one,
// delete the previous custom cursor, if there was one,
// and keep its Fl_RGB_Image if appropriate
delete_cursor_(xid, keep_copy);
//have this new cursor used
@ -1828,7 +1828,7 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) {
x(X); y(Y);
//fprintf(stderr, "move menuwin=%p x()=%d\n", pWindow, X);
} else {
//"a deliberate design trait of Wayland makes application windows ignorant of
//"a deliberate design trait of Wayland makes application windows ignorant of
// their exact placement on screen"
x(0); y(0);
}
@ -1906,7 +1906,7 @@ static void crect_intersect(cairo_rectangle_int_t *to, cairo_rectangle_int_t *wi
static bool crect_equal(cairo_rectangle_int_t *to, cairo_rectangle_int_t *with) {
return (to->x == with->x && to->y == with->y && to->width == with->width &&
return (to->x == with->x && to->y == with->y && to->width == with->width &&
to->height == with->height);
}
@ -1963,7 +1963,7 @@ void Fl_Wayland_Window_Driver::reposition_menu_window(int x, int y) {
*Fl_Window_Driver::menu_offset_y(pWindow) += (y - pWindow->y());
struct wld_window *xid = fl_wl_xid(pWindow);
wl_surface_set_opaque_region(xid->wl_surface, NULL);
if (xid->buffer) memset(xid->buffer->draw_buffer.buffer, 0,
if (xid->buffer) memset(xid->buffer->draw_buffer.buffer, 0,
xid->buffer->draw_buffer.data_size);
//printf("offset_y=%d\n", *Fl_Window_Driver::menu_offset_y(pWindow));
this->y(y);
@ -1988,7 +1988,7 @@ void Fl_Wayland_Window_Driver::reposition_menu_window(int x, int y) {
Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
xid_menu->wl_surface = wl_compositor_create_surface(scr_driver->wl_compositor);
wl_surface_add_listener(xid_menu->wl_surface, &surface_listener, xid_menu);
xid_menu->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base,
xid_menu->xdg_surface = xdg_wm_base_get_xdg_surface(scr_driver->xdg_wm_base,
xid_menu->wl_surface);
xdg_surface_add_listener(xid_menu->xdg_surface, &xdg_surface_listener, xid_menu);
struct xdg_positioner *positioner = xdg_wm_base_create_positioner(scr_driver->xdg_wm_base);
@ -2008,10 +2008,10 @@ void Fl_Wayland_Window_Driver::reposition_menu_window(int x, int y) {
xdg_positioner_set_size(positioner, pWindow->w() * f , pWindow->h() * f );
xdg_positioner_set_anchor(positioner, XDG_POSITIONER_ANCHOR_TOP_LEFT);
xdg_positioner_set_gravity(positioner, XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT);
xdg_positioner_set_constraint_adjustment(positioner,
xdg_positioner_set_constraint_adjustment(positioner,
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X);
xdg_positioner_set_offset(positioner, 0, popup_y);
xid_menu->xdg_popup = xdg_surface_get_popup(xid_menu->xdg_surface, parent_xid->xdg_surface,
xid_menu->xdg_popup = xdg_surface_get_popup(xid_menu->xdg_surface, parent_xid->xdg_surface,
positioner);
xdg_positioner_destroy(positioner);
struct win_positioner *win_pos = new struct win_positioner;
@ -2023,7 +2023,7 @@ void Fl_Wayland_Window_Driver::reposition_menu_window(int x, int y) {
wl_surface_commit(xid_menu->wl_surface);
wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display); // necessary with sway
// delete the previous popup
struct win_positioner *old_win_pos =
struct win_positioner *old_win_pos =
(struct win_positioner*)xdg_popup_get_user_data(old_popup);
xdg_popup_destroy(old_popup);
delete old_win_pos;

View File

@ -75,7 +75,7 @@ void write_data_source_cb(FL_SOCKET fd, data_source_write_struct *data) {
}
static void data_source_handle_send(void *data, struct wl_data_source *source,
static void data_source_handle_send(void *data, struct wl_data_source *source,
const char *mime_type, int fd) {
fl_intptr_t rank = (fl_intptr_t)data;
//fprintf(stderr, "data_source_handle_send: %s fd=%d l=%d\n", mime_type, fd, fl_selection_length[1]);
@ -149,7 +149,7 @@ static void data_source_handle_target(void *data, struct wl_data_source *source,
static uint32_t last_dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
static void data_source_handle_action(void *data, struct wl_data_source *source,
static void data_source_handle_action(void *data, struct wl_data_source *source,
uint32_t dnd_action) {
last_dnd_action = dnd_action;
switch (dnd_action) {
@ -190,7 +190,7 @@ static const struct wl_data_source_listener data_source_listener = {
};
static struct Fl_Wayland_Graphics_Driver::wld_buffer *offscreen_from_text(const char *text,
static struct Fl_Wayland_Graphics_Driver::wld_buffer *offscreen_from_text(const char *text,
int scale) {
const char *p, *q;
int width = 0, height, w2, ltext = strlen(text);
@ -260,7 +260,7 @@ int Fl_Wayland_Screen_Driver::dnd(int use_selection) {
} else dnd_icon = NULL;
doing_dnd = true;
wl_data_device_start_drag(scr_driver->seat->data_device, source,
scr_driver->seat->pointer_focus, dnd_icon,
scr_driver->seat->pointer_focus, dnd_icon,
scr_driver->seat->serial);
if (use_selection) {
wl_surface_attach(dnd_icon, off->wl_buffer, 0, 0);
@ -280,7 +280,7 @@ int Fl_Wayland_Screen_Driver::dnd(int use_selection) {
}
static void data_offer_handle_offer(void *data, struct wl_data_offer *offer,
static void data_offer_handle_offer(void *data, struct wl_data_offer *offer,
const char *mime_type) {
// runs when app becomes active and lists possible clipboard types
//fprintf(stderr, "Clipboard offer=%p supports MIME type: %s\n", offer, mime_type);
@ -301,7 +301,7 @@ static void data_offer_handle_offer(void *data, struct wl_data_offer *offer,
}
static void data_offer_handle_source_actions(void *data, struct wl_data_offer *offer,
static void data_offer_handle_source_actions(void *data, struct wl_data_offer *offer,
uint32_t actions) {
if (actions & WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY) {
//printf("Drag supports the copy action\n");
@ -309,7 +309,7 @@ static void data_offer_handle_source_actions(void *data, struct wl_data_offer *o
}
static void data_offer_handle_action(void *data, struct wl_data_offer *offer,
static void data_offer_handle_action(void *data, struct wl_data_offer *offer,
uint32_t dnd_action) {
switch (dnd_action) {
case WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE:
@ -332,7 +332,7 @@ static const struct wl_data_offer_listener data_offer_listener = {
};
static void data_device_handle_data_offer(void *data, struct wl_data_device *data_device,
static void data_device_handle_data_offer(void *data, struct wl_data_device *data_device,
struct wl_data_offer *offer) {
// An application has created a new data source
//fprintf(stderr, "data_device_handle_data_offer offer=%p\n", offer);
@ -342,7 +342,7 @@ static void data_device_handle_data_offer(void *data, struct wl_data_device *dat
}
static void data_device_handle_selection(void *data, struct wl_data_device *data_device,
static void data_device_handle_selection(void *data, struct wl_data_device *data_device,
struct wl_data_offer *offer) {
// An application has set the clipboard contents. W
//fprintf(stderr, "data_device_handle_selection\n");
@ -432,7 +432,7 @@ static struct wl_data_offer *current_drag_offer = NULL;
static uint32_t fl_dnd_serial;
static void data_device_handle_enter(void *data, struct wl_data_device *data_device,
static void data_device_handle_enter(void *data, struct wl_data_device *data_device,
uint32_t serial, struct wl_surface *surface,
wl_fixed_t x, wl_fixed_t y,
struct wl_data_offer *offer) {
@ -461,7 +461,7 @@ static void data_device_handle_enter(void *data, struct wl_data_device *data_dev
}
static void data_device_handle_motion(void *data, struct wl_data_device *data_device,
static void data_device_handle_motion(void *data, struct wl_data_device *data_device,
uint32_t time, wl_fixed_t x, wl_fixed_t y) {
if (!current_drag_offer) return;
//printf("data_device_handle_motion fl_dnd_target_window=%p\n", fl_dnd_target_window);
@ -536,7 +536,7 @@ static const struct wl_data_device_listener data_device_listener = {
};
const struct wl_data_device_listener *Fl_Wayland_Screen_Driver::p_data_device_listener =
const struct wl_data_device_listener *Fl_Wayland_Screen_Driver::p_data_device_listener =
&data_device_listener;
@ -570,7 +570,7 @@ static int get_clipboard_image() {
int ld = shared->ld() ? shared->ld() : shared->w() * shared->d();
uchar *rgb = new uchar[shared->w() * shared->h() * shared->d()];
memcpy(rgb, shared->data()[0], ld * shared->h() );
Fl_RGB_Image *image = new Fl_RGB_Image(rgb, shared->w(), shared->h(), shared->d(),
Fl_RGB_Image *image = new Fl_RGB_Image(rgb, shared->w(), shared->h(), shared->d(),
shared->ld());
shared->release();
image->alloc_array = 1;
@ -650,7 +650,7 @@ void Fl_Wayland_Screen_Driver::paste(Fl_Widget &receiver, int clipboard, const c
}
void Fl_Wayland_Screen_Driver::copy(const char *stuff, int len, int clipboard,
void Fl_Wayland_Screen_Driver::copy(const char *stuff, int len, int clipboard,
const char *type) {
if (!stuff || len < 0) return;
@ -669,13 +669,13 @@ void Fl_Wayland_Screen_Driver::copy(const char *stuff, int len, int clipboard,
fl_selection_type[clipboard] = Fl::clipboard_plain_text;
if (clipboard == 1) {
Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
scr_driver->seat->data_source =
scr_driver->seat->data_source =
wl_data_device_manager_create_data_source(scr_driver->seat->data_device_manager);
// we transmit the adequate value of index in fl_selection_buffer[index]
wl_data_source_add_listener(scr_driver->seat->data_source, &data_source_listener,
wl_data_source_add_listener(scr_driver->seat->data_source, &data_source_listener,
(void*)1);
wl_data_source_offer(scr_driver->seat->data_source, wld_plain_text_clipboard);
wl_data_device_set_selection(scr_driver->seat->data_device, scr_driver->seat->data_source,
wl_data_device_set_selection(scr_driver->seat->data_device, scr_driver->seat->data_source,
scr_driver->seat->keyboard_enter_serial);
//fprintf(stderr, "wl_data_device_set_selection len=%d to %d\n", len, clipboard);
}
@ -686,7 +686,7 @@ void Fl_Wayland_Screen_Driver::copy(const char *stuff, int len, int clipboard,
void Fl_Wayland_Screen_Driver::copy_image(const unsigned char *data, int W, int H){
if (!data || W <= 0 || H <= 0) return;
delete[] fl_selection_buffer[1];
fl_selection_buffer[1] =
fl_selection_buffer[1] =
(char *)Fl_Unix_System_Driver::create_bmp(data,W,H,&fl_selection_length[1]);
fl_selection_buffer_length[1] = fl_selection_length[1];
fl_i_own_selection[1] = 1;
@ -695,7 +695,7 @@ void Fl_Wayland_Screen_Driver::copy_image(const unsigned char *data, int W, int
// we transmit the adequate value of index in fl_selection_buffer[index]
wl_data_source_add_listener(seat->data_source, &data_source_listener, (void*)1);
wl_data_source_offer(seat->data_source, "image/bmp");
wl_data_device_set_selection(seat->data_device, seat->data_source,
wl_data_device_set_selection(seat->data_device, seat->data_source,
seat->keyboard_enter_serial);
//fprintf(stderr, "copy_image: len=%d\n", fl_selection_length[1]);
}

View File

@ -133,7 +133,7 @@ int Fl_System_Driver::filename_absolute(char *to, int tolen, const char *from, c
do not follow symlinks, and do not access the filesystem at all.
Path arguments must be absolute (start at the root directory) and must not
contain `.` or `..` segments, or double separators. A single trailing
contain `.` or `..` segments, or double separators. A single trailing
separator is ok.
On Windows, path arguments must start with a drive name, e.g. `c:\`.
@ -144,7 +144,7 @@ int Fl_System_Driver::filename_absolute(char *to, int tolen, const char *from, c
On Windows and macOS, the path segment tests are case insensitive.
If the path can not be generated, \a from path is copied into the \a to
If the path can not be generated, \a from path is copied into the \a to
buffer and 0 is returned.
\code

View File

@ -2201,6 +2201,7 @@ Fl_grab.o: ../FL/Fl_Valuator.H
Fl_grab.o: ../FL/Fl_Widget.H
Fl_grab.o: ../FL/platform_types.h
Fl_grab.o: Fl_Screen_Driver.H
Fl_Graphics_Driver.o: ../config.h
Fl_Graphics_Driver.o: ../FL/Enumerations.H
Fl_Graphics_Driver.o: ../FL/Fl.H
Fl_Graphics_Driver.o: ../FL/fl_attr.h
@ -3876,6 +3877,7 @@ Fl_Table_Row.o: ../FL/platform_types.h
Fl_Tabs.o: ../FL/Enumerations.H
Fl_Tabs.o: ../FL/Fl.H
Fl_Tabs.o: ../FL/fl_attr.h
Fl_Tabs.o: ../FL/Fl_Bitmap.H
Fl_Tabs.o: ../FL/Fl_Cairo.H
Fl_Tabs.o: ../FL/fl_casts.H
Fl_Tabs.o: ../FL/fl_config.h
@ -3889,6 +3891,7 @@ Fl_Tabs.o: ../FL/Fl_Tooltip.H
Fl_Tabs.o: ../FL/fl_types.h
Fl_Tabs.o: ../FL/fl_utf8.h
Fl_Tabs.o: ../FL/Fl_Widget.H
Fl_Tabs.o: ../FL/Fl_Window.H
Fl_Tabs.o: ../FL/platform_types.h
Fl_Text_Buffer.o: ../config.h
Fl_Text_Buffer.o: ../FL/Enumerations.H

View File

@ -35,7 +35,7 @@
// Enable one of the following two #include's depending on the GLUT implementation
// #include <GLUT/glut.h> // GLUT and FreeGLUT version
// #include <GLUT/glut.h> // GLUT and FreeGLUT version
#include <FL/glut.H> // FLTK version
#include <stdio.h>

View File

@ -1203,6 +1203,24 @@ glpuzzle.o: ../FL/glut.H
glpuzzle.o: ../FL/platform_types.h
glpuzzle.o: trackball.c
glpuzzle.o: trackball.h
glut_test.o: ../FL/Enumerations.H
glut_test.o: ../FL/Fl.H
glut_test.o: ../FL/fl_attr.h
glut_test.o: ../FL/Fl_Bitmap.H
glut_test.o: ../FL/Fl_Cairo.H
glut_test.o: ../FL/fl_casts.H
glut_test.o: ../FL/fl_config.h
glut_test.o: ../FL/Fl_Export.H
glut_test.o: ../FL/Fl_Gl_Window.H
glut_test.o: ../FL/Fl_Group.H
glut_test.o: ../FL/Fl_Image.H
glut_test.o: ../FL/fl_types.h
glut_test.o: ../FL/fl_utf8.h
glut_test.o: ../FL/Fl_Widget.H
glut_test.o: ../FL/Fl_Window.H
glut_test.o: ../FL/gl.h
glut_test.o: ../FL/glut.H
glut_test.o: ../FL/platform_types.h
gl_overlay.o: ../config.h
gl_overlay.o: ../FL/Enumerations.H
gl_overlay.o: ../FL/Fl.H