diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-01 18:03:10 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-06 20:28:20 +0200 |
| commit | f09e17c3c564e8310125a10c03397cbf473ff643 (patch) | |
| tree | 8d0fd4a28e3686c33aaa140d07ddba26ab28bdc2 /src/drivers/X11 | |
| parent | b0e0c355edaa2e23148cb0260ada907aec930f05 (diff) | |
Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files
- update .fl files and generated files accordingly
- replace 'http://www.fltk.org' URL's with 'https://...'
- replace bug report URL 'str.php' with 'bugs.php'
- remove trailing whitespace
- fix other whitespace errors flagged by Git
- add and/or fix missing or wrong standard headers
- convert tabs to spaces in all source files
The only relevant code changes are in the fluid/ folder where
some .fl files and other source files were used to generate
the '$Id' headers and footers.
Diffstat (limited to 'src/drivers/X11')
| -rw-r--r-- | src/drivers/X11/Fl_X11_Screen_Driver.H | 16 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Screen_Driver.cxx | 222 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_System_Driver.H | 14 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_System_Driver.cxx | 124 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.H | 20 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.cxx | 43 |
6 files changed, 201 insertions, 238 deletions
diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.H b/src/drivers/X11/Fl_X11_Screen_Driver.H index 09b043c71..c25337e0f 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.H +++ b/src/drivers/X11/Fl_X11_Screen_Driver.H @@ -1,6 +1,4 @@ // -// "$Id$" -// // Definition of X11 Screen interface // for the Fast Light Tool Kit (FLTK). // @@ -10,11 +8,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // -// Please report all bugs and problems on the following page: +// Please see the following page on how to report bugs and issues: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // /** @@ -31,7 +29,7 @@ class Fl_Window; -class FL_EXPORT Fl_X11_Screen_Driver : public Fl_Screen_Driver +class FL_EXPORT Fl_X11_Screen_Driver : public Fl_Screen_Driver { friend class Fl_Screen_Driver; protected: @@ -59,7 +57,7 @@ public: virtual void desktop_scale_factor(); int screen_num_unscaled(int x, int y); #endif - + static int ewmh_supported(); static void copy_image(const unsigned char* data, int W, int H, int destination); // --- display management @@ -108,7 +106,3 @@ public: #endif // FL_X11_SCREEN_DRIVER_H - -// -// End of "$Id$". -// diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.cxx b/src/drivers/X11/Fl_X11_Screen_Driver.cxx index b93d22ac6..a09768975 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Screen_Driver.cxx @@ -1,6 +1,4 @@ // -// "$Id$" -// // Definition of X11 Screen interface // // Copyright 1998-2018 by Bill Spitzak and others. @@ -9,11 +7,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // -// Please report all bugs and problems on the following page: +// Please see the following page on how to report bugs and issues: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // @@ -109,7 +107,7 @@ static double missed_timeout_by; /** Creates a driver that manages all screen and display related calls. - + This function must be implemented once for every platform. */ Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() @@ -197,7 +195,7 @@ int Fl_X11_Screen_Driver::visual(int flags) static int fl_workarea_xywh[4] = { -1, -1, -1, -1 }; -void Fl_X11_Screen_Driver::init_workarea() +void Fl_X11_Screen_Driver::init_workarea() { Atom actual; unsigned long count, remaining; @@ -323,8 +321,8 @@ void Fl_X11_Screen_Driver::init() { screens[i].width = xsi[i].width; screens[i].height = xsi[i].height; if (dpi_by_randr) { - dpi[i][0] = dpih; - dpi[i][1] = dpiv; + dpi[i][0] = dpih; + dpi[i][1] = dpiv; } else { int mm = DisplayWidthMM(fl_display, fl_screen); dpi[i][0] = mm ? screens[i].width*25.4f/mm : 0.0f; @@ -350,13 +348,13 @@ void Fl_X11_Screen_Driver::init() { screens[i].scale = 1; #endif if (dpi_by_randr) { - dpi[i][0] = dpih; - dpi[i][1] = dpiv; + dpi[i][0] = dpih; + dpi[i][1] = dpiv; } else { - int mm = DisplayWidthMM(fl_display, i); - dpi[i][0] = mm ? screens[i].width*25.4f/mm : 0.0f; - mm = DisplayHeightMM(fl_display, fl_screen); - dpi[i][1] = mm ? screens[i].height*25.4f/mm : 0.0f; + int mm = DisplayWidthMM(fl_display, i); + dpi[i][0] = mm ? screens[i].width*25.4f/mm : 0.0f; + mm = DisplayHeightMM(fl_display, fl_screen); + dpi[i][1] = mm ? screens[i].height*25.4f/mm : 0.0f; } } } @@ -533,8 +531,8 @@ void Fl_X11_Screen_Driver::grab(Fl_Window* win) GrabModeAsync, fl_event_time); } - Fl::grab_ = win; // FIXME: Fl::grab_ "should be private", but we need - // a way to *set* the variable from the driver! + Fl::grab_ = win; // FIXME: Fl::grab_ "should be private", but we need + // a way to *set* the variable from the driver! } else { if (Fl::grab()) { // We must keep the grab in the non-EWMH fullscreen case @@ -545,8 +543,8 @@ void Fl_X11_Screen_Driver::grab(Fl_Window* win) // this flush is done in case the picked menu item goes into // an infinite loop, so we don't leave the X server locked up: XFlush(fl_display); - Fl::grab_ = 0; // FIXME: Fl::grab_ "should be private", but we need - // a way to *set* the variable from the driver! + Fl::grab_ = 0; // FIXME: Fl::grab_ "should be private", but we need + // a way to *set* the variable from the driver! fl_fix_focus(); } } @@ -602,11 +600,11 @@ void Fl_X11_Screen_Driver::get_system_colors() if (Fl::first_window()) key1 = Fl::first_window()->xclass(); if (!key1) key1 = "fltk"; if (!bg2_set) - getsyscolor("Text","background", fl_bg2, "#ffffff", Fl::background2); + getsyscolor("Text","background", fl_bg2, "#ffffff", Fl::background2); if (!fg_set) - getsyscolor(key1, "foreground", fl_fg, "#000000", Fl::foreground); + getsyscolor(key1, "foreground", fl_fg, "#000000", Fl::foreground); if (!bg_set) - getsyscolor(key1, "background", fl_bg, "#c0c0c0", Fl::background); + getsyscolor(key1, "background", fl_bg, "#c0c0c0", Fl::background); getsyscolor("Text", "selectBackground", 0, "#000080", set_selection_color); } @@ -670,8 +668,8 @@ int Fl_X11_Screen_Driver::has_timeout(Fl_Timeout_Handler cb, void *argp) { Removes a timeout callback. It is harmless to remove a timeout callback that no longer exists. - \note This version removes all matching timeouts, not just the first one. - This may change in the future. + \note This version removes all matching timeouts, not just the first one. + This may change in the future. */ void Fl_X11_Screen_Driver::remove_timeout(Fl_Timeout_Handler cb, void *argp) { for (Timeout** p = &first_timeout; *p;) { @@ -720,7 +718,7 @@ fl_subimage_offsets(int a, int aw, int b, int bw, int &obw) { int off; int ob; - + if (b >= a) { ob = b; off = 0; @@ -728,15 +726,15 @@ fl_subimage_offsets(int a, int aw, int b, int bw, int &obw) ob = a; off = a - b; } - + bw -= off; - + if (ob + bw <= a + aw) { obw = bw; } else { obw = (a + aw) - ob; } - + return off; } @@ -750,23 +748,23 @@ extern "C" { Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int h, Fl_Window *win, bool may_capture_subwins, bool *did_capture_subwins) { - XImage *image; // Captured image - int i, maxindex; // Looping vars - int x, y; // Current X & Y in image - int d; // Depth of image - unsigned char *line, // Array to hold image row - *line_ptr; // Pointer to current line image - unsigned char *pixel; // Current color value - XColor colors[4096]; // Colors from the colormap... - unsigned char cvals[4096][3]; // Color values from the colormap... - unsigned index_mask, - index_shift, - red_mask, - red_shift, - green_mask, - green_shift, - blue_mask, - blue_shift; + XImage *image; // Captured image + int i, maxindex; // Looping vars + int x, y; // Current X & Y in image + int d; // Depth of image + unsigned char *line, // Array to hold image row + *line_ptr; // Pointer to current line image + unsigned char *pixel; // Current color value + XColor colors[4096]; // Colors from the colormap... + unsigned char cvals[4096][3]; // Color values from the colormap... + unsigned index_mask, + index_shift, + red_mask, + red_shift, + green_mask, + green_shift, + blue_mask, + blue_shift; // // Under X11 we have the option of the XGetImage() interface or SGI's // ReadDisplay extension which does all of the really hard work for @@ -774,12 +772,12 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int // int allow_outside = w < 0; // negative w allows negative X or Y, that is, window frame if (w < 0) w = - w; - + Window xid = (win && !allow_outside ? fl_xid(win) : fl_window); float s = allow_outside ? Fl::screen_driver()->scale(win->screen_num()) : Fl_Surface_Device::surface()->driver()->scale(); int ws = w * s, hs = h * s, Xs = X*s, Ys = Y*s; - + # ifdef __sgi if (XReadDisplayQueryExtension(fl_display, &i, &i)) { image = XReadDisplay(fl_display, xid, Xs, Ys, ws, hs, 0, NULL); @@ -787,12 +785,12 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int # else image = 0; # endif // __sgi - + if (!image) { // fetch absolute coordinates int dx, dy, sx, sy, sw, sh; Window child_win; - + if (win) { XTranslateCoordinates(fl_display, xid, RootWindow(fl_display, fl_screen), Xs, Ys, &dx, &dy, &child_win); @@ -821,7 +819,7 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int noffx = fl_subimage_offsets(sx, sw, dx, ws, nw); noffy = fl_subimage_offsets(sy, sh, dy, hs, nh); if (nw <= 0 || nh <= 0) return 0; - + // allocate the image int bpp = fl_visual->depth + ((fl_visual->depth / 8) % 2) * 8; char* buf = (char*)malloc((bpp / 8) * ws * hs); @@ -831,7 +829,7 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int if (buf) free(buf); return 0; } - + XErrorHandler old_handler = XSetErrorHandler(xgetimageerrhandler); XImage *subimg = XGetSubImage(fl_display, xid, Xs + noffx, Ys + noffy, nw, nh, AllPlanes, ZPixmap, image, noffx, noffy); @@ -842,13 +840,13 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int } } } - + if (!image) return 0; if (s != 1) { w = ws; h = hs; } - + #ifdef DEBUG printf("width = %d\n", image->width); printf("height = %d\n", image->height); @@ -867,23 +865,23 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int printf("blue_mask = %08x\n", image->blue_mask); printf("map_entries = %d\n", fl_visual->visual->map_entries); #endif // DEBUG - + d = 3; uchar *p = NULL; // Allocate the image data array as needed... const uchar *oldp = p; if (!p) p = new uchar[w * h * d]; - + // Initialize the default colors/alpha in the whole image... memset(p, 0, w * h * d); - + // Check that we have valid mask/shift values... if (!image->red_mask && image->bits_per_pixel > 12) { // Greater than 12 bits must be TrueColor... image->red_mask = fl_visual->visual->red_mask; image->green_mask = fl_visual->visual->green_mask; image->blue_mask = fl_visual->visual->blue_mask; - + #ifdef DEBUG // Defined in Fl_Xlib_Graphics_Driver_color.cxx extern uchar fl_redmask, fl_greenmask, fl_bluemask; @@ -900,27 +898,27 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int printf("blue_mask = %08x\n", image->blue_mask); #endif // DEBUG } - + // Check if we have colormap image... if (!image->red_mask) { // Get the colormap entries for this window... maxindex = fl_visual->visual->map_entries; - + for (i = 0; i < maxindex; i ++) colors[i].pixel = i; - + XQueryColors(fl_display, fl_colormap, colors, maxindex); - + for (i = 0; i < maxindex; i ++) { cvals[i][0] = colors[i].red >> 8; cvals[i][1] = colors[i].green >> 8; cvals[i][2] = colors[i].blue >> 8; } - + // Read the pixels and output an RGB image... for (y = 0; y < image->height; y ++) { pixel = (unsigned char *)(image->data + y * image->bytes_per_line); line = p + y * w * d; - + switch (image->bits_per_pixel) { case 1 : for (x = image->width, line_ptr = line, index_mask = 128; @@ -935,7 +933,7 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int line_ptr[1] = cvals[0][1]; line_ptr[2] = cvals[0][2]; } - + if (index_mask > 1) { index_mask >>= 1; } else { @@ -944,17 +942,17 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int } } break; - + case 2 : for (x = image->width, line_ptr = line, index_shift = 6; x > 0; x --, line_ptr += d) { i = (*pixel >> index_shift) & 3; - + line_ptr[0] = cvals[i][0]; line_ptr[1] = cvals[i][1]; line_ptr[2] = cvals[i][2]; - + if (index_shift > 0) { index_shift -= 2; } else { @@ -963,18 +961,18 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int } } break; - + case 4 : for (x = image->width, line_ptr = line, index_shift = 4; x > 0; x --, line_ptr += d) { if (index_shift == 4) i = (*pixel >> 4) & 15; else i = *pixel & 15; - + line_ptr[0] = cvals[i][0]; line_ptr[1] = cvals[i][1]; line_ptr[2] = cvals[i][2]; - + if (index_shift > 0) { index_shift = 0; } else { @@ -983,7 +981,7 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int } } break; - + case 8 : for (x = image->width, line_ptr = line; x > 0; @@ -993,7 +991,7 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int line_ptr[2] = cvals[*pixel][2]; } break; - + case 12 : for (x = image->width, line_ptr = line, index_shift = 0; x > 0; @@ -1003,11 +1001,11 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int } else { i = ((pixel[1] << 8) | pixel[2]) & 4095; } - + line_ptr[0] = cvals[i][0]; line_ptr[1] = cvals[i][1]; line_ptr[2] = cvals[i][2]; - + if (index_shift == 0) { index_shift = 4; } else { @@ -1022,46 +1020,46 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int // RGB(A) image, so figure out the shifts & masks... red_mask = image->red_mask; red_shift = 0; - + while ((red_mask & 1) == 0) { red_mask >>= 1; red_shift ++; } - + green_mask = image->green_mask; green_shift = 0; - + while ((green_mask & 1) == 0) { green_mask >>= 1; green_shift ++; } - + blue_mask = image->blue_mask; blue_shift = 0; - + while ((blue_mask & 1) == 0) { blue_mask >>= 1; blue_shift ++; } - + // Read the pixels and output an RGB image... for (y = 0; y < image->height; y ++) { pixel = (unsigned char *)(image->data + y * image->bytes_per_line); line = p + y * w * d; - + switch (image->bits_per_pixel) { case 8 : for (x = image->width, line_ptr = line; x > 0; x --, line_ptr += d, pixel ++) { i = *pixel; - + line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask; line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask; line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask; } break; - + case 12 : for (x = image->width, line_ptr = line, index_shift = 0; x > 0; @@ -1071,11 +1069,11 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int } else { i = ((pixel[1] << 8) | pixel[2]) & 4095; } - + line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask; line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask; line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask; - + if (index_shift == 0) { index_shift = 4; } else { @@ -1084,7 +1082,7 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int } } break; - + case 16 : if (image->byte_order == LSBFirst) { // Little-endian... @@ -1092,7 +1090,7 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int x > 0; x --, line_ptr += d, pixel += 2) { i = (pixel[1] << 8) | pixel[0]; - + line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask; line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask; line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask; @@ -1103,14 +1101,14 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int x > 0; x --, line_ptr += d, pixel += 2) { i = (pixel[0] << 8) | pixel[1]; - + line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask; line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask; line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask; } } break; - + case 24 : if (image->byte_order == LSBFirst) { // Little-endian... @@ -1118,7 +1116,7 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int x > 0; x --, line_ptr += d, pixel += 3) { i = (((pixel[2] << 8) | pixel[1]) << 8) | pixel[0]; - + line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask; line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask; line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask; @@ -1129,14 +1127,14 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int x > 0; x --, line_ptr += d, pixel += 3) { i = (((pixel[0] << 8) | pixel[1]) << 8) | pixel[2]; - + line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask; line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask; line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask; } } break; - + case 32 : if (image->byte_order == LSBFirst) { // Little-endian... @@ -1144,7 +1142,7 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int x > 0; x --, line_ptr += d, pixel += 4) { i = (((((pixel[3] << 8) | pixel[2]) << 8) | pixel[1]) << 8) | pixel[0]; - + line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask; line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask; line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask; @@ -1155,7 +1153,7 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int x > 0; x --, line_ptr += d, pixel += 4) { i = (((((pixel[0] << 8) | pixel[1]) << 8) | pixel[2]) << 8) | pixel[3]; - + line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask; line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask; line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask; @@ -1165,10 +1163,10 @@ Fl_RGB_Image *Fl_X11_Screen_Driver::read_win_rectangle(int X, int Y, int w, int } } } - + // Destroy the X image we've read and return the RGB(A) image... XDestroyImage(image); - + Fl_RGB_Image *rgb = new Fl_RGB_Image(p, w, h, d); if (!oldp) rgb->alloc_array = 1; return rgb; @@ -1191,7 +1189,7 @@ int Fl_X11_Screen_Driver::screen_num_unscaled(int x, int y) { int screen = -1; if (num_screens < 0) init(); - + for (int i = 0; i < num_screens; i ++) { int sx = screens[i].x_org, sy = screens[i].y_org, sw = screens[i].width, sh = screens[i].height; if ((x >= sx) && (x < (sx+sw)) && (y >= sy) && (y < (sy+sh))) { @@ -1247,7 +1245,7 @@ static void* value_of_key_in_schema(const char **known, const char *schema, cons // in the gsettings database. /* returns true under Ubuntu or Debian or FreeBSD and when the gnome scaling value has been found - + Ubuntu: Change the gnome scaling factor with: System Settings ==> Displays ==> Scale for menu and title bars @@ -1255,10 +1253,10 @@ static void* value_of_key_in_schema(const char **known, const char *schema, cons gsettings get com.ubuntu.user-interface scale-factor Example value: {'VGA-0': 10} Its type is "a{si}". This value should be divided by 8 to get the correct scaling factor. - + In Ubuntu 18, file $HOME/.config/monitors.xml contains the gnome scaling factor value, and FLTK reads that. - + Debian or FreeBSD : Change the gnome scaling factor with: Tweak tools ==> Windows ==> Window scaling @@ -1266,19 +1264,19 @@ static void* value_of_key_in_schema(const char **known, const char *schema, cons gsettings get org.gnome.settings-daemon.plugins.xsettings overrides Example value: {'Gdk/WindowScalingFactor': <2>} Its type is "a{sv}" and v itself is of type i - + It's also possible to use 'Tweak tools' under Ubuntu. With the standard Ubuntu desktop, the modified value goes to "org.gnome.settings-daemon.plugins.xsettings" as above. - + With Gnome session flashback under Ubuntu 'Tweak tools' puts the scaling value (1 or 2) in "org.gnome.desktop.interface scaling-factor". Read the current gnome scaling factor with: gsettings get org.gnome.desktop.interface scaling-factor Its type is "u" - - Thus, under Ubuntu, we read the 3 possible factor values and + + Thus, under Ubuntu, we read the 3 possible factor values and return the first value different from 1 to get the scaling factor. - + ================================================================================================= Ubuntu | default ubuntu desktop | System Settings => Displays => Scale for menu and title bars com.ubuntu.user-interface scale-factor @@ -1303,12 +1301,12 @@ static void* value_of_key_in_schema(const char **known, const char *schema, cons void *gobj = dlopen("libgobject-2.0.so", RTLD_LAZY); //fprintf(stderr,"glib=%p gio=%p gobj=%p\n",glib,gio,gobj); if (!glib || !gio || !gobj) return false; - + // define pters to used functions and variables g_settings_list_schemas_ftype g_settings_list_schemas_f = (g_settings_list_schemas_ftype)dlsym(gio, "g_settings_list_schemas"); // 2.26 g_settings_new_f = (g_settings_new_ftype)dlsym(gio, "g_settings_new"); // 2.26 g_settings_get_value_f = - (g_settings_get_value_ftype)dlsym(gio, "g_settings_get_value"); // 2.26 + (g_settings_get_value_ftype)dlsym(gio, "g_settings_get_value"); // 2.26 if (!g_settings_list_schemas_f || !g_settings_new_f || !g_settings_get_value_f) return false; g_variant_get_ftype g_variant_get_f = (g_variant_get_ftype)dlsym(glib, "g_variant_get"); //2.24 g_variant_iter_loop_ftype g_variant_iter_loop_f = (g_variant_iter_loop_ftype)dlsym(glib, "g_variant_iter_loop"); // 2.24 @@ -1320,7 +1318,7 @@ static void* value_of_key_in_schema(const char **known, const char *schema, cons //g_variant_get_type_ftype g_variant_get_type_f = (g_variant_get_type_ftype)dlsym(glib, "g_variant_get_type"); // 2.24 const unsigned *glib_major_version = (const unsigned *)dlsym(glib, "glib_major_version"); const unsigned *glib_minor_version = (const unsigned *)dlsym(glib, "glib_minor_version"); - + // call dynamic lib functions if (*glib_major_version * 1000 + *glib_minor_version < 2036) { typedef void (*init_ftype)(void); @@ -1331,7 +1329,7 @@ static void* value_of_key_in_schema(const char **known, const char *schema, cons float ubuntu_f = 1, ubuntu_desktop_f = 1, gnome_f = 1; bool found = false; void *gvar; - + bool ubuntu = false; // determine whether we run Ubuntu char line[400] = ""; @@ -1341,7 +1339,7 @@ static void* value_of_key_in_schema(const char **known, const char *schema, cons fclose(in); if (s && strstr(line, "Ubuntu")) ubuntu = true; } - + if (ubuntu) { gvar = value_of_key_in_schema(known, "com.ubuntu.user-interface", "scale-factor"); if (gvar) { @@ -1419,7 +1417,3 @@ void Fl_X11_Screen_Driver::desktop_scale_factor() } #endif // USE_XFT - -// -// End of "$Id$". -// diff --git a/src/drivers/X11/Fl_X11_System_Driver.H b/src/drivers/X11/Fl_X11_System_Driver.H index 138959d75..7c2306a28 100644 --- a/src/drivers/X11/Fl_X11_System_Driver.H +++ b/src/drivers/X11/Fl_X11_System_Driver.H @@ -1,6 +1,4 @@ // -// "$Id$" -// // Definition of Posix system driver // for the Fast Light Tool Kit (FLTK). // @@ -10,11 +8,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // -// Please report all bugs and problems on the following page: +// Please see the following page on how to report bugs and issues: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // #ifndef FL_X11_SYSTEM_DRIVER_H @@ -46,7 +44,7 @@ public: virtual void newUUID(char *uuidBuffer); virtual char *preference_rootnode(Fl_Preferences *prefs, Fl_Preferences::Root root, const char *vendor, const char *application); - virtual int preferences_need_protection_check() {return 1;} + virtual int preferences_need_protection_check() {return 1;} virtual int utf8locale(); // this one is in Fl_own_colormap.cxx virtual void own_colormap(); @@ -70,7 +68,3 @@ public: }; #endif /* FL_X11_SYSTEM_DRIVER_H */ - -// -// End of "$Id$". -// diff --git a/src/drivers/X11/Fl_X11_System_Driver.cxx b/src/drivers/X11/Fl_X11_System_Driver.cxx index 4914c1a29..0714ff753 100644 --- a/src/drivers/X11/Fl_X11_System_Driver.cxx +++ b/src/drivers/X11/Fl_X11_System_Driver.cxx @@ -1,6 +1,4 @@ // -// "$Id$" -// // Definition of Posix system driver // for the Fast Light Tool Kit (FLTK). // @@ -10,11 +8,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // -// Please report all bugs and problems on the following page: +// Please see the following page on how to report bugs and issues: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // #include "Fl_X11_System_Driver.H" @@ -65,7 +63,7 @@ extern "C" { /** Creates a driver that manages all system related calls. - + This function must be implemented once for every platform. */ Fl_System_Driver *Fl_System_Driver::newSystemDriver() @@ -92,33 +90,33 @@ int Fl_X11_System_Driver::clocale_printf(FILE *output, const char *format, va_li // Find a program in the path... static char *path_find(const char *program, char *filename, int filesize) { - const char *path; // Search path - char *ptr, // Pointer into filename - *end; // End of filename buffer - - + const char *path; // Search path + char *ptr, // Pointer into filename + *end; // End of filename buffer + + if ((path = fl_getenv("PATH")) == NULL) path = "/bin:/usr/bin"; - + for (ptr = filename, end = filename + filesize - 1; *path; path ++) { if (*path == ':') { if (ptr > filename && ptr[-1] != '/' && ptr < end) *ptr++ = '/'; - + strlcpy(ptr, program, end - ptr + 1); - + if (!access(filename, X_OK)) return filename; - + ptr = filename; } else if (ptr < end) *ptr++ = *path; } - + if (ptr > filename) { if (ptr[-1] != '/' && ptr < end) *ptr++ = '/'; - + strlcpy(ptr, program, end - ptr + 1); - + if (!access(filename, X_OK)) return filename; } - + return 0; } @@ -136,10 +134,10 @@ int Fl_X11_System_Driver::open_uri(const char *uri, char *msg, int msglen) // Note that we specifically do not support the MAILER and // BROWSER environment variables because we have no idea whether // we need to run the listed commands in a terminal program. - char command[FL_PATH_MAX], // Command to run... - *argv[4], // Command-line arguments - remote[1024]; // Remote-mode command... - const char * const *commands; // Array of commands to check... + char command[FL_PATH_MAX], // Command to run... + *argv[4], // Command-line arguments + remote[1024]; // Remote-mode command... + const char * const *commands; // Array of commands to check... int i; static const char * const browsers[] = { "xdg-open", // Portland @@ -170,35 +168,35 @@ int Fl_X11_System_Driver::open_uri(const char *uri, char *msg, int msglen) "konqueror", // KDE NULL }; - + // Figure out which commands to check for... if (!strncmp(uri, "file://", 7)) commands = managers; else if (!strncmp(uri, "mailto:", 7) || !strncmp(uri, "news:", 5)) commands = readers; else commands = browsers; - + // Find the command to run... for (i = 0; commands[i]; i ++) if (path_find(commands[i], command, sizeof(command))) break; - + if (!commands[i]) { if (msg) { snprintf(msg, msglen, "No helper application found for \"%s\"", uri); } - + return 0; } - + // Handle command-specific arguments... argv[0] = (char *)commands[i]; - + if (!strcmp(commands[i], "firefox") || !strcmp(commands[i], "mozilla") || !strcmp(commands[i], "netscape") || !strcmp(commands[i], "thunderbird")) { // program -remote openURL(uri) snprintf(remote, sizeof(remote), "openURL(%s)", uri); - + argv[1] = (char *)"-remote"; argv[2] = remote; argv[3] = 0; @@ -212,16 +210,16 @@ int Fl_X11_System_Driver::open_uri(const char *uri, char *msg, int msglen) argv[1] = (char *)uri; argv[2] = 0; } - + if (msg) { strlcpy(msg, argv[0], msglen); - + for (i = 1; argv[i]; i ++) { strlcat(msg, " ", msglen); strlcat(msg, argv[i], msglen); } } - + return run_program(command, argv, msg, msglen) != 0; } @@ -236,7 +234,7 @@ int Fl_X11_System_Driver::file_browser_load_filesystem(Fl_File_Browser *browser, int res = -1, len; char *list = NULL, *name; struct vmount *vp; - + // We always have the root filesystem add("/", icon); // Get the required buffer size for the vmount structures @@ -274,7 +272,7 @@ int Fl_X11_System_Driver::file_browser_load_filesystem(Fl_File_Browser *browser, // http://www.daemon-systems.org/man/getmntinfo.3.html int res = -1; struct statvfs *list; - + // We always have the root filesystem browser->add("/", icon); # ifdef HAVE_PTHREAD @@ -303,8 +301,8 @@ int Fl_X11_System_Driver::file_browser_load_filesystem(Fl_File_Browser *browser, // // UNIX code uses /etc/fstab or similar... // - FILE *mtab; // /etc/mtab or /etc/mnttab file - char line[FL_PATH_MAX]; // Input line + FILE *mtab; // /etc/mtab or /etc/mnttab file + char line[FL_PATH_MAX]; // Input line // Every Unix has a root filesystem '/'. // This ensures that the user don't get an empty @@ -317,15 +315,15 @@ int Fl_X11_System_Driver::file_browser_load_filesystem(Fl_File_Browser *browser, // // Note: this misses automounted filesystems on FreeBSD if absent from /etc/fstab // - - mtab = fopen("/etc/mnttab", "r"); // Fairly standard + + mtab = fopen("/etc/mnttab", "r"); // Fairly standard if (mtab == NULL) - mtab = fopen("/etc/mtab", "r"); // More standard + mtab = fopen("/etc/mtab", "r"); // More standard if (mtab == NULL) - mtab = fopen("/etc/fstab", "r"); // Otherwise fallback to full list + mtab = fopen("/etc/fstab", "r"); // Otherwise fallback to full list if (mtab == NULL) - mtab = fopen("/etc/vfstab", "r"); // Alternate full list file - + mtab = fopen("/etc/vfstab", "r"); // Alternate full list file + if (mtab != NULL) { while (fgets(line, sizeof(line), mtab) != NULL) @@ -336,15 +334,15 @@ int Fl_X11_System_Driver::file_browser_load_filesystem(Fl_File_Browser *browser, continue; if (strcmp("/", filename) == 0) continue; // "/" was added before - + // Add a trailing slash (except for the root filesystem) strlcat(filename, "/", lname); - + // printf("Fl_File_Browser::load() - adding \"%s\" to list...\n", filename); browser->add(filename, icon); num_files ++; } - + fclose(mtab); } #endif // _AIX || ... @@ -357,17 +355,17 @@ void Fl_X11_System_Driver::newUUID(char *uuidBuffer) // #include <uuid/uuid.h> // void uuid_generate(uuid_t out); unsigned char b[16]; - time_t t = time(0); // first 4 byte + time_t t = time(0); // first 4 byte b[0] = (unsigned char)t; b[1] = (unsigned char)(t>>8); b[2] = (unsigned char)(t>>16); b[3] = (unsigned char)(t>>24); - int r = rand(); // four more bytes + int r = rand(); // four more bytes b[4] = (unsigned char)r; b[5] = (unsigned char)(r>>8); b[6] = (unsigned char)(r>>16); b[7] = (unsigned char)(r>>24); - unsigned long a = (unsigned long)&t; // four more bytes + unsigned long a = (unsigned long)&t; // four more bytes b[8] = (unsigned char)a; b[9] = (unsigned char)(a>>8); b[10] = (unsigned char)(a>>16); @@ -390,7 +388,7 @@ void Fl_X11_System_Driver::newUUID(char *uuidBuffer) b[10] = v.a[2]; b[11] = v.a[3]; # endif - char name[80]; // last four bytes + char name[80]; // last four bytes gethostname(name, 79); memcpy(b+12, name, 4); sprintf(uuidBuffer, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", @@ -425,7 +423,7 @@ char *Fl_X11_System_Driver::preference_rootnode(Fl_Preferences *prefs, Fl_Prefer strcpy(filename, "/etc/fltk/"); break; } - + // Make sure that the parameters are not NULL if ( (vendor==0L) || (vendor[0]==0) ) vendor = "unknown"; @@ -449,12 +447,12 @@ int Fl_X11_System_Driver::XParseGeometry(const char* string, int* x, int* y, int Fl_X11_System_Driver::filename_list(const char *d, dirent ***list, int (*sort)(struct dirent **, struct dirent **) ) { int dirlen; char *dirloc; - + // Assume that locale encoding is no less dense than UTF-8 dirlen = strlen(d); dirloc = (char *)malloc(dirlen + 1); fl_utf8to_mb(d, dirlen, dirloc, dirlen + 1); - + #ifndef HAVE_SCANDIR // This version is when we define our own scandir int n = fl_scandir(dirloc, list, 0, sort); @@ -475,31 +473,31 @@ int Fl_X11_System_Driver::filename_list(const char *d, dirent ***list, int (*sor // changes: int n = scandir(dirloc, list, 0, (int(*)(const void*,const void*))sort); #endif - + free(dirloc); - + // convert every filename to UTF-8, and append a '/' to all // filenames that are directories int i; char *fullname = (char*)malloc(dirlen+FL_PATH_MAX+3); // Add enough extra for two /'s and a nul // Use memcpy for speed since we already know the length of the string... memcpy(fullname, d, dirlen+1); - + char *name = fullname + dirlen; if (name!=fullname && name[-1]!='/') *name++ = '/'; - + for (i=0; i<n; i++) { int newlen; dirent *de = (*list)[i]; int len = strlen(de->d_name); newlen = fl_utf8from_mb(NULL, 0, de->d_name, len); dirent *newde = (dirent*)malloc(de->d_name - (char*)de + newlen + 2); // Add space for a / and a nul - + // Conversion to UTF-8 memcpy(newde, de, de->d_name - (char*)de); fl_utf8from_mb(newde->d_name, newlen + 1, de->d_name, len); - + // Check if dir (checks done on "old" name as we need to interact with // the underlying OS) if (de->d_name[len-1]!='/' && len<=FL_PATH_MAX) { @@ -511,12 +509,12 @@ int Fl_X11_System_Driver::filename_list(const char *d, dirent ***list, int (*sor *dst = 0; } } - + free(de); (*list)[i] = newde; } free(fullname); - + return n; } @@ -619,7 +617,3 @@ const char *Fl_X11_System_Driver::shortcut_add_key_name(unsigned key, char *p, c } #endif // !defined(FL_DOXYGEN) - -// -// End of "$Id$". -// diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H index 604b7d622..098808c72 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.H +++ b/src/drivers/X11/Fl_X11_Window_Driver.H @@ -1,6 +1,4 @@ // -// "$Id$" -// // Definition of X11 window driver // for the Fast Light Tool Kit (FLTK). // @@ -10,11 +8,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // -// Please report all bugs and problems on the following page: +// Please see the following page on how to report bugs and issues: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // /** @@ -35,13 +33,13 @@ class Fl_Bitmap; There is one window driver for each Fl_Window. Window drivers manage window actions such as resizing, events, decoration, fullscreen modes, etc. . All - drawing and rendering is managed by the Surface device and the associated + drawing and rendering is managed by the Surface device and the associated graphics driver. - window specific event handling - window types and styles, depth, etc. - decorations - + ? where do we handle the interface between OpenGL/DirectX and Cocoa/Windows/Glx? */ @@ -86,7 +84,7 @@ private: char backbuffer_bad; void flush_double_dbe(int erase_overlay); #endif - + public: Fl_X11_Window_Driver(Fl_Window*); virtual ~Fl_X11_Window_Driver(); @@ -95,7 +93,7 @@ public: virtual int screen_num(); static void resize_after_screen_change(void *data); #endif // USE_XFT - + // --- window data virtual int decorated_w(); virtual int decorated_h(); @@ -144,7 +142,3 @@ public: #endif // FL_X11_WINDOW_DRIVER_H - -// -// End of "$Id$". -// diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index 50a013ba6..19fc70b09 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx @@ -1,6 +1,4 @@ // -// "$Id$" -// // Definition of X11 window driver. // // Copyright 1998-2020 by Bill Spitzak and others. @@ -9,11 +7,11 @@ // the file "COPYING" which should have been included with this file. If this // file is missing or damaged, see the license at: // -// http://www.fltk.org/COPYING.php +// https://www.fltk.org/COPYING.php // -// Please report all bugs and problems on the following page: +// Please see the following page on how to report bugs and issues: // -// http://www.fltk.org/str.php +// https://www.fltk.org/bugs.php // @@ -34,8 +32,8 @@ #if HAVE_DLFCN_H #include <dlfcn.h> #endif -#define ShapeBounding 0 -#define ShapeSet 0 +#define ShapeBounding 0 +#define ShapeSet 0 #if HAVE_OVERLAY extern XVisualInfo *fl_find_overlay_visual(); @@ -89,7 +87,7 @@ void Fl_X11_Window_Driver::flush_double_dbe(int erase_overlay) if (i->region) {Fl_Graphics_Driver::default_driver().XDestroyRegion(i->region); i->region = 0;} pWindow->clear_damage(FL_DAMAGE_ALL); backbuffer_bad = 0; - } + } // Redraw as needed... if (pWindow->damage()) { fl_clip_region(i->region); i->region = 0; @@ -181,7 +179,7 @@ int Fl_X11_Window_Driver::decorated_h() int Fl_X11_Window_Driver::decorated_w() { int w, h; - + decorated_win_size(w, h); return w; } @@ -191,8 +189,8 @@ void Fl_X11_Window_Driver::take_focus() { Fl_X *i = Fl_X::i(pWindow); if (!Fl_X11_Screen_Driver::ewmh_supported()) - pWindow->show(); // Old WMs, XMapRaised - else if (i) // New WMs use the NETWM attribute: + pWindow->show(); // Old WMs, XMapRaised + else if (i) // New WMs use the NETWM attribute: activate_window(); } @@ -351,7 +349,7 @@ void Fl_X11_Window_Driver::combine_mask() void Fl_X11_Window_Driver::icons(const Fl_RGB_Image *icons[], int count) { free_icons(); - + if (count > 0) { icon_->icons = new Fl_RGB_Image*[count]; icon_->count = count; @@ -361,7 +359,7 @@ void Fl_X11_Window_Driver::icons(const Fl_RGB_Image *icons[], int count) { icon_->icons[i]->normalize(); } } - + if (Fl_X::i(pWindow)) set_icons(); } @@ -392,7 +390,7 @@ void Fl_X11_Window_Driver::free_icons() { (or NULL if a particular border is absent). 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. - + This function exploits a feature of Fl_X11_Screen_Driver::read_win_rectangle() which, when called with negative 3rd argument, captures the window decoration. Other requirement to capture the window decoration: @@ -449,7 +447,7 @@ void Fl_X11_Window_Driver::make_current() { #if USE_XFT ((Fl_Xlib_Graphics_Driver*)fl_graphics_driver)->scale(Fl::screen_driver()->scale(screen_num())); #endif - + #ifdef FLTK_USE_CAIRO // update the cairo_t context if (Fl::cairo_autolink_context()) Fl::cairo_make_current(pWindow); @@ -529,20 +527,20 @@ void Fl_X11_Window_Driver::decoration_sizes(int *top, int *left, int *right, in void Fl_X11_Window_Driver::show_with_args_begin() { // Get defaults for drag-n-drop and focus... const char *key = 0, *val; - + if (Fl::first_window()) key = Fl::first_window()->xclass(); if (!key) key = "fltk"; - + val = XGetDefault(fl_display, key, "dndTextOps"); if (val) Fl::dnd_text_ops(strcasecmp(val, "true") == 0 || strcasecmp(val, "on") == 0 || strcasecmp(val, "yes") == 0); - + val = XGetDefault(fl_display, key, "tooltips"); if (val) Fl_Tooltip::enable(strcasecmp(val, "true") == 0 || strcasecmp(val, "on") == 0 || strcasecmp(val, "yes") == 0); - + val = XGetDefault(fl_display, key, "visibleFocus"); if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 || strcasecmp(val, "on") == 0 || @@ -624,7 +622,7 @@ void Fl_X11_Window_Driver::redraw_overlay() { overlay(new _Fl_Overlay(0,0,w(),h())); Fl_Group::current(0); } else { - overlay(pWindow); // fake the overlay + overlay(pWindow); // fake the overlay } } if (shown()) { @@ -712,8 +710,3 @@ int Fl_X11_Window_Driver::screen_num() { return screen_num_ >= 0 ? screen_num_ : 0; } #endif // USE_XFT - - -// -// End of "$Id$". -// |
