diff --git a/FL/Fl_Bitmap.H b/FL/Fl_Bitmap.H index 7fde10f5b..677af7db4 100644 --- a/FL/Fl_Bitmap.H +++ b/FL/Fl_Bitmap.H @@ -61,6 +61,8 @@ public: void label(Fl_Widget*w) FL_OVERRIDE; void label(Fl_Menu_Item*m) FL_OVERRIDE; void uncache() FL_OVERRIDE; + int cache_w() {return cache_w_;} + int cache_h() {return cache_h_;} }; #endif diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H index 1d7c3d702..49d6d4fc4 100644 --- a/FL/Fl_Graphics_Driver.H +++ b/FL/Fl_Graphics_Driver.H @@ -383,7 +383,7 @@ public: Fl_Fontsize size; /**< font size */ Fl_Font_Descriptor(const char* fontname, Fl_Fontsize size); virtual FL_EXPORT ~Fl_Font_Descriptor() {} - short ascent, descent; + int ascent, descent; unsigned int listbase;// base of display list, 0 = none }; diff --git a/FL/Fl_Image.H b/FL/Fl_Image.H index eb7aef3c6..a8f514f36 100644 --- a/FL/Fl_Image.H +++ b/FL/Fl_Image.H @@ -369,6 +369,8 @@ public: void label(Fl_Widget*w) FL_OVERRIDE; void label(Fl_Menu_Item*m) FL_OVERRIDE; void uncache() FL_OVERRIDE; + int cache_w() {return cache_w_;} + int cache_h() {return cache_h_;} /** Sets the maximum allowed image size in bytes when creating an Fl_RGB_Image object. The image size in bytes of an Fl_RGB_Image object is the value of the product w() * h() * d(). diff --git a/FL/Fl_Pixmap.H b/FL/Fl_Pixmap.H index ddf996fba..0efdb84c7 100644 --- a/FL/Fl_Pixmap.H +++ b/FL/Fl_Pixmap.H @@ -72,6 +72,8 @@ public: void label(Fl_Widget*w) FL_OVERRIDE; void label(Fl_Menu_Item*m) FL_OVERRIDE; void uncache() FL_OVERRIDE; + int cache_w() {return cache_w_;} + int cache_h() {return cache_h_;} }; #endif diff --git a/FL/Fl_Text_Display.H b/FL/Fl_Text_Display.H index 2d2d2d565..c736db1e0 100644 --- a/FL/Fl_Text_Display.H +++ b/FL/Fl_Text_Display.H @@ -498,7 +498,7 @@ protected: int leftClip, int rightClip) const; int handle_rmb(int readonly); - + void draw_line_numbers(bool clearAll); void clear_rect(int style, int x, int y, int width, int height) const; diff --git a/fluid/factory.cxx b/fluid/factory.cxx index 3a433748d..a60717e30 100644 --- a/fluid/factory.cxx +++ b/fluid/factory.cxx @@ -868,7 +868,7 @@ public: int tsize_; Fl_Color tcolor_; Fl_Batchmode_Terminal(int x, int y, int w, int h, const char *l=NULL) - : Fl_Group(x, y, w, h, l) + : Fl_Group(x, y, w, h, l) { // set the defaults that Fl_Terminal would set box(FL_DOWN_BOX); color(FL_FOREGROUND_COLOR); diff --git a/fluid/makedepend b/fluid/makedepend index 6eedbd947..88d7b722b 100644 --- a/fluid/makedepend +++ b/fluid/makedepend @@ -74,11 +74,11 @@ alignment_panel.o: ../FL/Fl_Scheme.H alignment_panel.o: ../FL/Fl_Scheme_Choice.H alignment_panel.o: ../FL/Fl_Scrollbar.H alignment_panel.o: ../FL/Fl_Shortcut_Button.H -alignment_panel.o: ../FL/Fl_Simple_Terminal.H alignment_panel.o: ../FL/Fl_Slider.H alignment_panel.o: ../FL/Fl_Spinner.H alignment_panel.o: ../FL/fl_string_functions.h alignment_panel.o: ../FL/Fl_Tabs.H +alignment_panel.o: ../FL/Fl_Terminal.H alignment_panel.o: ../FL/Fl_Text_Buffer.H alignment_panel.o: ../FL/Fl_Text_Display.H alignment_panel.o: ../FL/Fl_Text_Editor.H @@ -363,10 +363,10 @@ factory.o: ../FL/Fl_Repeat_Button.H factory.o: ../FL/Fl_RGB_Image.H factory.o: ../FL/Fl_Roller.H factory.o: ../FL/Fl_Scrollbar.H -factory.o: ../FL/Fl_Simple_Terminal.H factory.o: ../FL/Fl_Slider.H factory.o: ../FL/Fl_Spinner.H factory.o: ../FL/Fl_Tabs.H +factory.o: ../FL/Fl_Terminal.H factory.o: ../FL/Fl_Text_Buffer.H factory.o: ../FL/Fl_Text_Display.H factory.o: ../FL/Fl_Text_Editor.H @@ -448,11 +448,11 @@ Fd_Snap_Action.o: ../FL/Fl_Scheme.H Fd_Snap_Action.o: ../FL/Fl_Scheme_Choice.H Fd_Snap_Action.o: ../FL/Fl_Scrollbar.H Fd_Snap_Action.o: ../FL/Fl_Shortcut_Button.H -Fd_Snap_Action.o: ../FL/Fl_Simple_Terminal.H Fd_Snap_Action.o: ../FL/Fl_Slider.H Fd_Snap_Action.o: ../FL/Fl_Spinner.H Fd_Snap_Action.o: ../FL/fl_string_functions.h Fd_Snap_Action.o: ../FL/Fl_Tabs.H +Fd_Snap_Action.o: ../FL/Fl_Terminal.H Fd_Snap_Action.o: ../FL/Fl_Text_Buffer.H Fd_Snap_Action.o: ../FL/Fl_Text_Display.H Fd_Snap_Action.o: ../FL/Fl_Text_Editor.H @@ -530,11 +530,11 @@ file.o: ../FL/Fl_Scheme_Choice.H file.o: ../FL/Fl_Scrollbar.H file.o: ../FL/Fl_Shared_Image.H file.o: ../FL/Fl_Shortcut_Button.H -file.o: ../FL/Fl_Simple_Terminal.H file.o: ../FL/Fl_Slider.H file.o: ../FL/Fl_Spinner.H file.o: ../FL/fl_string_functions.h file.o: ../FL/Fl_Tabs.H +file.o: ../FL/Fl_Terminal.H file.o: ../FL/Fl_Text_Buffer.H file.o: ../FL/Fl_Text_Display.H file.o: ../FL/Fl_Text_Editor.H @@ -623,11 +623,11 @@ fluid.o: ../FL/Fl_Scheme_Choice.H fluid.o: ../FL/Fl_Scrollbar.H fluid.o: ../FL/Fl_Shared_Image.H fluid.o: ../FL/Fl_Shortcut_Button.H -fluid.o: ../FL/Fl_Simple_Terminal.H fluid.o: ../FL/Fl_Slider.H fluid.o: ../FL/Fl_Spinner.H fluid.o: ../FL/fl_string_functions.h fluid.o: ../FL/Fl_Tabs.H +fluid.o: ../FL/Fl_Terminal.H fluid.o: ../FL/Fl_Text_Buffer.H fluid.o: ../FL/Fl_Text_Display.H fluid.o: ../FL/Fl_Text_Editor.H @@ -869,6 +869,7 @@ Fl_Function_Type.o: Fl_Window_Type.h Fl_Function_Type.o: function_panel.h Fl_Function_Type.o: mergeback.h Fl_Function_Type.o: StyleParse.h +Fl_Function_Type.o: undo.h Fl_Function_Type.o: widget_browser.h Fl_Grid_Type.o: ../config.h Fl_Grid_Type.o: ../FL/Enumerations.H @@ -1149,12 +1150,12 @@ Fl_Widget_Type.o: ../FL/Fl_Scrollbar.H Fl_Widget_Type.o: ../FL/Fl_Shared_Image.H Fl_Widget_Type.o: ../FL/Fl_Shortcut_Button.H Fl_Widget_Type.o: ../FL/fl_show_colormap.H -Fl_Widget_Type.o: ../FL/Fl_Simple_Terminal.H Fl_Widget_Type.o: ../FL/Fl_Slider.H Fl_Widget_Type.o: ../FL/Fl_Spinner.H Fl_Widget_Type.o: ../FL/fl_string_functions.h Fl_Widget_Type.o: ../FL/Fl_Table.H Fl_Widget_Type.o: ../FL/Fl_Tabs.H +Fl_Widget_Type.o: ../FL/Fl_Terminal.H Fl_Widget_Type.o: ../FL/Fl_Text_Buffer.H Fl_Widget_Type.o: ../FL/Fl_Text_Display.H Fl_Widget_Type.o: ../FL/Fl_Text_Editor.H @@ -1247,11 +1248,11 @@ Fl_Window_Type.o: ../FL/Fl_Scheme_Choice.H Fl_Window_Type.o: ../FL/Fl_Scrollbar.H Fl_Window_Type.o: ../FL/Fl_Shared_Image.H Fl_Window_Type.o: ../FL/Fl_Shortcut_Button.H -Fl_Window_Type.o: ../FL/Fl_Simple_Terminal.H Fl_Window_Type.o: ../FL/Fl_Slider.H Fl_Window_Type.o: ../FL/Fl_Spinner.H Fl_Window_Type.o: ../FL/fl_string_functions.h Fl_Window_Type.o: ../FL/Fl_Tabs.H +Fl_Window_Type.o: ../FL/Fl_Terminal.H Fl_Window_Type.o: ../FL/Fl_Text_Buffer.H Fl_Window_Type.o: ../FL/Fl_Text_Display.H Fl_Window_Type.o: ../FL/Fl_Text_Editor.H @@ -1299,7 +1300,6 @@ function_panel.o: ../FL/Fl_Browser_.H function_panel.o: ../FL/Fl_Button.H function_panel.o: ../FL/Fl_Cairo.H function_panel.o: ../FL/fl_casts.H -function_panel.o: ../FL/Fl_Check_Button.H function_panel.o: ../FL/Fl_Choice.H function_panel.o: ../FL/fl_config.h function_panel.o: ../FL/Fl_Device.H @@ -1478,11 +1478,11 @@ shell_command.o: ../FL/Fl_Scheme.H shell_command.o: ../FL/Fl_Scheme_Choice.H shell_command.o: ../FL/Fl_Scrollbar.H shell_command.o: ../FL/Fl_Shortcut_Button.H -shell_command.o: ../FL/Fl_Simple_Terminal.H shell_command.o: ../FL/Fl_Slider.H shell_command.o: ../FL/Fl_Spinner.H shell_command.o: ../FL/fl_string_functions.h shell_command.o: ../FL/Fl_Tabs.H +shell_command.o: ../FL/Fl_Terminal.H shell_command.o: ../FL/Fl_Text_Buffer.H shell_command.o: ../FL/Fl_Text_Display.H shell_command.o: ../FL/Fl_Text_Editor.H diff --git a/fluid/sourceview_panel.cxx b/fluid/sourceview_panel.cxx index b32f01498..0b7c52306 100644 --- a/fluid/sourceview_panel.cxx +++ b/fluid/sourceview_panel.cxx @@ -32,7 +32,7 @@ extern void reveal_in_browser(Fl_Type *t); /** 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 diff --git a/fluid/template_panel.cxx b/fluid/template_panel.cxx index 0911deb7e..33f2cabea 100644 --- a/fluid/template_panel.cxx +++ b/fluid/template_panel.cxx @@ -307,7 +307,7 @@ void template_load() { "er\n}\n", f); fclose(f); } - + template_install(path, "/FLTK_License.fl", tmpl_FLTK_License_fl, sizeof(tmpl_FLTK_License_fl), tmpl_FLTK_License_fl_size); template_install(path, "/1of7GUIs.fl", tmpl_1of7GUIs_fl, sizeof(tmpl_1of7GUIs_fl), tmpl_1of7GUIs_fl_size); sample_templates_generated = 2; diff --git a/fluid/template_panel.fl b/fluid/template_panel.fl index 2a98219b0..790702edc 100644 --- a/fluid/template_panel.fl +++ b/fluid/template_panel.fl @@ -265,7 +265,7 @@ if (sample_templates_generated < 2) { "er\\n}\\n", f); fclose(f); } - + template_install(path, "/FLTK_License.fl", tmpl_FLTK_License_fl, sizeof(tmpl_FLTK_License_fl), tmpl_FLTK_License_fl_size); template_install(path, "/1of7GUIs.fl", tmpl_1of7GUIs_fl, sizeof(tmpl_1of7GUIs_fl), tmpl_1of7GUIs_fl_size); sample_templates_generated = 2; diff --git a/libdecor/src/cursor-settings.c b/libdecor/src/cursor-settings.c index 225034cdd..e7082e25e 100644 --- a/libdecor/src/cursor-settings.c +++ b/libdecor/src/cursor-settings.c @@ -42,8 +42,6 @@ get_setting_sync(DBusConnection *const connection, DBusMessage *message; DBusMessage *reply; - dbus_error_init(&error); - message = dbus_message_new_method_call( "org.freedesktop.portal.Desktop", "/org/freedesktop/portal/desktop", @@ -58,6 +56,8 @@ get_setting_sync(DBusConnection *const connection, if (!success) return NULL; + dbus_error_init(&error); + reply = dbus_connection_send_with_reply_and_block( connection, message, @@ -66,9 +66,12 @@ get_setting_sync(DBusConnection *const connection, dbus_message_unref(message); - if (dbus_error_is_set(&error)) + if (dbus_error_is_set(&error)) { + dbus_error_free(&error); return NULL; + } + dbus_error_free(&error); return reply; } diff --git a/src/Fl_Browser_.cxx b/src/Fl_Browser_.cxx index b05772aea..56b751415 100644 --- a/src/Fl_Browser_.cxx +++ b/src/Fl_Browser_.cxx @@ -953,9 +953,9 @@ J1: */ Fl_Browser_::Fl_Browser_(int X, int Y, int W, int H, const char* L) : Fl_Group(X, Y, W, H, L), + linespacing_(0), scrollbar(0, 0, 0, 0, 0), // they will be resized by draw() - hscrollbar(0, 0, 0, 0, 0), - linespacing_(0) + hscrollbar(0, 0, 0, 0, 0) { box(FL_NO_BOX); align(FL_ALIGN_BOTTOM); diff --git a/src/Fl_Tile.cxx b/src/Fl_Tile.cxx index e1e2d85cc..c37f2da89 100644 --- a/src/Fl_Tile.cxx +++ b/src/Fl_Tile.cxx @@ -56,7 +56,7 @@ In this mode, the child that is marked resizable() will behave as it would in a regular Fl_Group widget. When dragging edges or intersections with the mouse, Fl_Tile will ensure that - none of the children shrinks to a size that is smaller than requested. + none of the children shrinks to a size that is smaller than requested. When resizing the Fl_Tile group, size ranges are not enforced by the tile. Instead, the size range of the enclosing window should be limited to a valid range. @@ -155,7 +155,7 @@ static Fl_Cursor Fl_Tile_cursors[4] = { static int fl_min(int a, int b) { return ab ? a : b; } -/** +/** Request for children to change their layout. drag_intersection requests that all children with the left edge at old_l to @@ -695,7 +695,7 @@ int Fl_Tile::handle(int event) { // if (damage()) return 1; // don't fall behind case FL_RELEASE: { if (!sdrag) break; - Fl_Widget* r = resizable(); + Fl_Widget* r = resizable(); if (size_range_ || !r) r = this; int newx; if (sdrag&DRAGH) { diff --git a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H index b965e0afa..8677a920f 100644 --- a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H +++ b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H @@ -153,7 +153,7 @@ public: void ps_translate(int, int); void ps_untranslate(); - void draw_cached_pattern_(Fl_Image *img, cairo_pattern_t *pat, int X, int Y, int W, int H, int cx, int cy); + void draw_cached_pattern_(Fl_Image *img, cairo_pattern_t *pat, int X, int Y, int W, int H, int cx, int cy, int cache_w, int cache_h); void draw_image(const uchar *data, int ix, int iy, int iw, int ih, int D, int LD) FL_OVERRIDE; void draw_rgb(Fl_RGB_Image *rgb,int XP, int YP, int WP, int HP, int cx, int cy) FL_OVERRIDE; void cache(Fl_RGB_Image *rgb) FL_OVERRIDE; diff --git a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx index be189f7bf..cda328c17 100644 --- a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx +++ b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx @@ -783,7 +783,7 @@ void Fl_Cairo_Graphics_Driver::overlay_rect(int x, int y, int w , int h) { } -void Fl_Cairo_Graphics_Driver::draw_cached_pattern_(Fl_Image *img, cairo_pattern_t *pat, int X, int Y, int W, int H, int cx, int cy) { +void Fl_Cairo_Graphics_Driver::draw_cached_pattern_(Fl_Image *img, cairo_pattern_t *pat, int X, int Y, int W, int H, int cx, int cy, int cache_w, int cache_h) { // compute size of output image in drawing units cairo_matrix_t matrix; cairo_get_matrix(cairo_, &matrix); @@ -794,7 +794,7 @@ void Fl_Cairo_Graphics_Driver::draw_cached_pattern_(Fl_Image *img, cairo_pattern int Hs = Fl_Scalable_Graphics_Driver::floor(Y - cy + img->h(), s) - Ys; if (Ws == 0 || Hs == 0) return; cairo_save(cairo_); - bool need_extend = (img->data_w() != Ws || img->data_h() != Hs || (W >= 2 && H >= 2)); + bool need_extend = (cache_w != Ws || cache_h != Hs || (W >= 2 && H >= 2)); if (need_extend || cx || cy || W < img->w() || H < img->h()) { // clip when necessary cairo_rectangle(cairo_, X - 0.5, Y - 0.5, W + 0.5, H + 0.5); cairo_clip(cairo_); @@ -805,11 +805,12 @@ void Fl_Cairo_Graphics_Driver::draw_cached_pattern_(Fl_Image *img, cairo_pattern cairo_set_matrix(cairo_, &matrix); if (img->d() >= 1) cairo_set_source(cairo_, pat); if (need_extend) { - cairo_pattern_set_filter(pat, Fl_RGB_Image::scaling_algorithm() == FL_RGB_SCALING_BILINEAR ? - CAIRO_FILTER_GOOD : CAIRO_FILTER_FAST); + bool condition = Fl_RGB_Image::scaling_algorithm() == FL_RGB_SCALING_BILINEAR && + (fabs(Ws/float(cache_w) - 1) > 0.02 || fabs(Hs/float(cache_h) - 1) > 0.02); + cairo_pattern_set_filter(pat, condition ? CAIRO_FILTER_GOOD : CAIRO_FILTER_FAST); cairo_pattern_set_extend(pat, CAIRO_EXTEND_PAD); } - cairo_matrix_init_scale(&matrix, double(img->data_w())/Ws, double(img->data_h())/Hs); + cairo_matrix_init_scale(&matrix, double(cache_w)/Ws, double(cache_h)/Hs); cairo_matrix_translate(&matrix, -Xs , -Ys ); cairo_pattern_set_matrix(pat, &matrix); if (img->d() > 1) cairo_paint(cairo_); @@ -834,7 +835,7 @@ void Fl_Cairo_Graphics_Driver::draw_rgb(Fl_RGB_Image *rgb,int XP, int YP, int WP cache(rgb); pat = (cairo_pattern_t*)*Fl_Graphics_Driver::id(rgb); } - draw_cached_pattern_(rgb, pat, X, Y, W, H, cx, cy); + draw_cached_pattern_(rgb, pat, X, Y, W, H, cx, cy, rgb->cache_w(), rgb->cache_h()); } @@ -909,7 +910,7 @@ void Fl_Cairo_Graphics_Driver::uncache(Fl_RGB_Image *img, fl_uintptr_t &id_, fl_ } -void Fl_Cairo_Graphics_Driver::draw_fixed(Fl_Bitmap *bm,int XP, int YP, int WP, int HP, +void Fl_Cairo_Graphics_Driver::draw_fixed(Fl_Bitmap *bm,int XP, int YP, int WP, int HP, int cx, int cy) { cairo_pattern_t *pat = NULL; float s = wld_scale * scale(); @@ -927,7 +928,10 @@ void Fl_Cairo_Graphics_Driver::draw_fixed(Fl_Bitmap *bm,int XP, int YP, int WP, } else { pat = (cairo_pattern_t*)*Fl_Graphics_Driver::id(bm); color(color()); - draw_cached_pattern_(bm, pat, XP, YP, WP, HP, cx, cy); + int old_w = bm->w(), old_h = bm->h(); + bm->scale(bm->cache_w(), bm->cache_h(), 0, 1); // transiently + draw_cached_pattern_(bm, pat, XP, YP, WP, HP, cx, cy, bm->cache_w(), bm->cache_h()); + bm->scale(old_w, old_h, 0, 1); // back } cairo_set_matrix(cairo_, &matrix); } @@ -995,7 +999,7 @@ void Fl_Cairo_Graphics_Driver::cache(Fl_Bitmap *bm) { } -void Fl_Cairo_Graphics_Driver::draw_fixed(Fl_Pixmap *pxm,int XP, int YP, int WP, int HP, +void Fl_Cairo_Graphics_Driver::draw_fixed(Fl_Pixmap *pxm,int XP, int YP, int WP, int HP, int cx, int cy) { cairo_pattern_t *pat = NULL; float s = wld_scale * scale(); @@ -1013,7 +1017,10 @@ void Fl_Cairo_Graphics_Driver::draw_fixed(Fl_Pixmap *pxm,int XP, int YP, int WP, Fl_Graphics_Driver::draw_empty(pxm, XP, YP); } else { pat = (cairo_pattern_t*)*Fl_Graphics_Driver::id(pxm); - draw_cached_pattern_(pxm, pat, XP, YP, WP, HP, cx, cy); + int old_w = pxm->w(), old_h = pxm->h(); + pxm->scale(pxm->cache_w(), pxm->cache_h(), 0, 1); // transiently + draw_cached_pattern_(pxm, pat, XP, YP, WP, HP, cx, cy, pxm->cache_w(), pxm->cache_h()); + pxm->scale(old_w, old_h, 0, 1); // back } cairo_set_matrix(cairo_, &matrix); } diff --git a/src/drivers/PostScript/Fl_PostScript.cxx b/src/drivers/PostScript/Fl_PostScript.cxx index 4ce3f67b9..f5d8f8f11 100644 --- a/src/drivers/PostScript/Fl_PostScript.cxx +++ b/src/drivers/PostScript/Fl_PostScript.cxx @@ -145,12 +145,11 @@ Fl_PostScript_Graphics_Driver::Fl_PostScript_Graphics_Driver(void) //lang_level_ = 3; lang_level_ = 2; mask = 0; -#endif - ps_filename_ = NULL; - scale_x = scale_y = 1.; bg_r = bg_g = bg_b = 255; clip_ = NULL; - what = NONE; + scale_x = scale_y = 1.; +#endif + ps_filename_ = NULL; } /** \brief The destructor. */ @@ -1750,9 +1749,9 @@ Fl_EPS_File_Surface::Fl_EPS_File_Surface(int width, int height, FILE *eps, Fl_Co if (s != 1) { ps->clocale_printf("GR GR GS %f %f SC GS\n", s, s); } + Fl::get_color(background, ps->bg_r, ps->bg_g, ps->bg_b); #endif ps->scale_x = ps->scale_y = s; - Fl::get_color(background, ps->bg_r, ps->bg_g, ps->bg_b); } } diff --git a/src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H b/src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H index fef8ded71..904644f42 100644 --- a/src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H +++ b/src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H @@ -1,7 +1,7 @@ // // Support for graphics output to PostScript file for the Fast Light Tool Kit (FLTK). // -// Copyright 2010-2022 by Bill Spitzak and others. +// Copyright 2010-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -49,7 +49,6 @@ public: char *ps_filename_; int nPages; double pw_, ph_; - uchar bg_r, bg_g, bg_b; Fl_PostScript_Graphics_Driver(); ~Fl_PostScript_Graphics_Driver(); @@ -80,11 +79,13 @@ public: int not_clipped(int x, int y, int w, int h) FL_OVERRIDE; int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H) FL_OVERRIDE; virtual int has_feature(driver_feature feature_mask) FL_OVERRIDE { return feature_mask & PRINTER; } +#if !FLTK_USE_CAIRO // draw image classes without caching them - void draw_rgb_bitmap_(Fl_Image *img,int XP, int YP, int WP, int HP, int cx, int cy); - void draw_pixmap(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy) FL_OVERRIDE; - void draw_bitmap(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy) FL_OVERRIDE; - void draw_rgb(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy) FL_OVERRIDE; + void draw_rgb_bitmap_(Fl_Image *img,int XP, int YP, int WP, int HP, int cx, int cy); + void draw_pixmap(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy) FL_OVERRIDE; + void draw_bitmap(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy) FL_OVERRIDE; + void draw_rgb(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy) FL_OVERRIDE; +#endif // !FLTK_USE_CAIRO }; #else // ! USE_PANGO diff --git a/src/drivers/PostScript/Fl_PostScript_image.cxx b/src/drivers/PostScript/Fl_PostScript_image.cxx index 64f9972bf..c78627727 100644 --- a/src/drivers/PostScript/Fl_PostScript_image.cxx +++ b/src/drivers/PostScript/Fl_PostScript_image.cxx @@ -1,7 +1,7 @@ // // Postscript image drawing implementation for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2022 by Bill Spitzak and others. +// Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -68,7 +68,9 @@ void Fl_PostScript_Graphics_Driver::draw_image(const uchar *data, int ix, int iy draw_image(draw_image_cb, &cb_data, ix, iy, iw, ih, abs(D)); } -#if USE_PANGO +#if USE_PANGO + +#if !FLTK_USE_CAIRO static void destroy_BGRA(void *data) { delete[] (uchar*)data; @@ -180,7 +182,9 @@ void Fl_PostScript_Graphics_Driver::draw_rgb_bitmap_(Fl_Image *img,int XP, int Y } } -#else // USE_PANGO +#endif // !FLTK_USE_CAIRO + +#else // ! USE_PANGO // // Implementation of the /ASCII85Encode PostScript filter diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H index 83b13e155..df321fc10 100644 --- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H +++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.H @@ -46,6 +46,8 @@ private: void swap_buffers() FL_OVERRIDE; void resize(int is_a_resize, int w, int h) FL_OVERRIDE; char swap_type() FL_OVERRIDE; + void swap_interval(int) FL_OVERRIDE; + int swap_interval() const FL_OVERRIDE; Fl_Gl_Choice *find(int m, const int *alistp) FL_OVERRIDE; GLContext create_gl_context(Fl_Window* window, const Fl_Gl_Choice* g) FL_OVERRIDE; void set_gl_context(Fl_Window* w, GLContext context) FL_OVERRIDE; diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx index 4553c1a0e..ac625fe6f 100644 --- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx @@ -63,6 +63,9 @@ struct gl_start_support { // to support use of gl_start / gl_finish static EGLConfig wld_egl_conf = NULL; +static EGLint swap_interval_ = 1; +static EGLint max_swap_interval = 1000; +static EGLint min_swap_interval = 0; EGLDisplay Fl_Wayland_Gl_Window_Driver::egl_display = EGL_NO_DISPLAY; @@ -170,6 +173,9 @@ Fl_Gl_Choice *Fl_Wayland_Gl_Window_Driver::find(int m, const int *alistp) Fl::fatal("failed to choose an EGL config\n"); } + eglGetConfigAttrib(egl_display, g->egl_conf, EGL_MAX_SWAP_INTERVAL, &max_swap_interval); + eglGetConfigAttrib(egl_display, g->egl_conf, EGL_MIN_SWAP_INTERVAL, &min_swap_interval); + first = g; return g; } @@ -431,6 +437,18 @@ void Fl_Wayland_Gl_Window_Driver::gl_start() { glClear(GL_COLOR_BUFFER_BIT); } +void Fl_Wayland_Gl_Window_Driver::swap_interval(int interval) { + if (interval < min_swap_interval) interval = min_swap_interval; + if (interval > max_swap_interval) interval = max_swap_interval; + if (egl_display && eglSwapInterval(egl_display, interval)) + swap_interval_ = interval; + // printf("swap_interval_=%d\n",swap_interval_); +} + + +int Fl_Wayland_Gl_Window_Driver::swap_interval() const { + return swap_interval_; +} FL_EXPORT EGLContext fl_wl_glcontext(GLContext rc) { return (EGLContext)rc; } diff --git a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx index fd07308fa..c2611e739 100644 --- a/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Gl_Window_Driver.cxx @@ -397,41 +397,90 @@ char Fl_X11_Gl_Window_Driver::swap_type() { return copy; } -typedef void (*SWAPINTERVALPROC) (Display *dpy, GLXDrawable drawable, int interval); -static SWAPINTERVALPROC glXSwapIntervalEXT = NULL; -static bool glXSwapIntervalChecked = false; -static void checkGlxXSwapInterval() { - if (!glXSwapIntervalChecked) { - glXSwapIntervalChecked = true; - glXSwapIntervalEXT = (SWAPINTERVALPROC)glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalEXT"); + +// Start of swap_interval implementation in the three possibel ways for X11 + +// -1 = not yet initialized, 0 = none found, 1 = GLX, 2 = MESA, 3 = SGI +static signed char swap_interval_type = -1; + +typedef void (*GLX_Set_Swap_Iterval_Proc) (Display *dpy, GLXDrawable drawable, int interval); +typedef int (*MESA_Set_Swap_Iterval_Proc) (unsigned int interval); +typedef int (*MESA_Get_Swap_Iterval_Proc) (); +typedef int (*SGI_Set_Swap_Iterval_Proc) (int interval); + +static union { + GLX_Set_Swap_Iterval_Proc glXSwapIntervalEXT = NULL; + MESA_Set_Swap_Iterval_Proc glXSwapIntervalMESA; + SGI_Set_Swap_Iterval_Proc glXSwapIntervalSGI; +}; + +static MESA_Get_Swap_Iterval_Proc glXGetSwapIntervalMESA = NULL; + +static void init_swap_interval() { + if (swap_interval_type != -1) return; + int major = 1, minor = 0; + glXQueryVersion(fl_display, &major, &minor); + swap_interval_type = 0; + const char *extensions = glXQueryExtensionsString(fl_display, fl_screen); + if (strstr(extensions, "GLX_EXT_swap_control") && ((major > 1) || (minor >= 3))) { + glXSwapIntervalEXT = (GLX_Set_Swap_Iterval_Proc)glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalEXT"); + swap_interval_type = 1; + } else if (strstr(extensions, "GLX_MESA_swap_control")) { + glXSwapIntervalMESA = (MESA_Set_Swap_Iterval_Proc)glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalMESA"); + glXGetSwapIntervalMESA = (MESA_Get_Swap_Iterval_Proc)glXGetProcAddressARB((const GLubyte*)"glXGetSwapIntervalMESA"); + swap_interval_type = 2; + } else if (strstr(extensions, "GLX_SGI_swap_control")) { + glXSwapIntervalSGI = (SGI_Set_Swap_Iterval_Proc)glXGetProcAddressARB((const GLubyte*)"glXSwapIntervalSGI"); + swap_interval_type = 3; } } void Fl_X11_Gl_Window_Driver::swap_interval(int interval) { if (!fl_xid(pWindow)) return; - if (!glXSwapIntervalChecked) checkGlxXSwapInterval(); - if (glXSwapIntervalEXT) { - glXSwapIntervalEXT(fl_display, fl_xid(pWindow), interval); + if (swap_interval_type == -1) + init_swap_interval(); + switch (swap_interval_type) { + case 1: + if (glXSwapIntervalEXT) + glXSwapIntervalEXT(fl_display, fl_xid(pWindow), interval); + break; + case 2: + if (glXSwapIntervalMESA) + glXSwapIntervalMESA((unsigned int)interval); + break; + case 3: + if (glXSwapIntervalSGI) + glXSwapIntervalSGI(interval); + break; } } int Fl_X11_Gl_Window_Driver::swap_interval() const { if (!fl_xid(pWindow)) return -1; - if (!glXSwapIntervalChecked) checkGlxXSwapInterval(); - if (!glXSwapIntervalEXT) return -1; - static bool ext_checked = false, ext_exists = false; - if (!ext_checked) { - ext_checked = true; - ext_exists = (strstr(glXQueryExtensionsString(fl_display, fl_screen), "GLX_EXT_swap_control") != NULL); + if (swap_interval_type == -1) + init_swap_interval(); + int interval = -1; + switch (swap_interval_type) { + case 1: { + unsigned int val = 0; + glXQueryDrawable(fl_display, fl_xid(pWindow), 0x20F1 /*GLX_SWAP_INTERVAL_EXT*/, &val); + interval = (int)val; + break; } + case 2: + if (glXGetSwapIntervalMESA) + interval = glXGetSwapIntervalMESA(); + break; + case 3: + // not available + break; } - if (!ext_exists) return -1; - unsigned int interval = -1; - glXQueryDrawable(fl_display, fl_xid(pWindow), 0x20F1 /*GLX_SWAP_INTERVAL_EXT*/, &interval); return interval; } +// end of swap_interval implementation + void Fl_X11_Gl_Window_Driver::waitGL() { glXWaitGL(); } diff --git a/src/makedepend b/src/makedepend index 0199f9d96..a7cf18d19 100644 --- a/src/makedepend +++ b/src/makedepend @@ -2439,6 +2439,7 @@ Fl_Input.o: ../FL/Fl_Image.H Fl_Input.o: ../FL/Fl_Input.H Fl_Input.o: ../FL/Fl_Input_.H Fl_Input.o: ../FL/Fl_Int_Input.H +Fl_Input.o: ../FL/Fl_Menu_Item.H Fl_Input.o: ../FL/Fl_Multiline_Input.H Fl_Input.o: ../FL/Fl_Multiline_Output.H Fl_Input.o: ../FL/Fl_Output.H @@ -3929,6 +3930,9 @@ Fl_Text_Display.o: ../FL/Fl_Export.H Fl_Text_Display.o: ../FL/Fl_Graphics_Driver.H Fl_Text_Display.o: ../FL/Fl_Group.H Fl_Text_Display.o: ../FL/Fl_Image.H +Fl_Text_Display.o: ../FL/Fl_Input.H +Fl_Text_Display.o: ../FL/Fl_Input_.H +Fl_Text_Display.o: ../FL/Fl_Menu_Item.H Fl_Text_Display.o: ../FL/Fl_Pixmap.H Fl_Text_Display.o: ../FL/Fl_Plugin.H Fl_Text_Display.o: ../FL/Fl_Preferences.H diff --git a/test/makedepend b/test/makedepend index 2a0a8da55..73ac5d0db 100644 --- a/test/makedepend +++ b/test/makedepend @@ -3149,3 +3149,18 @@ windowfocus.o: ../FL/fl_utf8.h windowfocus.o: ../FL/Fl_Widget.H windowfocus.o: ../FL/Fl_Window.H windowfocus.o: ../FL/platform_types.h +wizard.o: ../FL/Enumerations.H +wizard.o: ../FL/Fl.H +wizard.o: ../FL/fl_attr.h +wizard.o: ../FL/Fl_Button.H +wizard.o: ../FL/Fl_Cairo.H +wizard.o: ../FL/fl_casts.H +wizard.o: ../FL/fl_config.h +wizard.o: ../FL/Fl_Export.H +wizard.o: ../FL/Fl_Group.H +wizard.o: ../FL/fl_types.h +wizard.o: ../FL/fl_utf8.h +wizard.o: ../FL/Fl_Widget.H +wizard.o: ../FL/Fl_Window.H +wizard.o: ../FL/Fl_Wizard.H +wizard.o: ../FL/platform_types.h