FLTK logo

Re: [fltk.coredev] GL differences - X11 vs Wayland (WSL2, in case that matters!)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: GL differences - X11 vs Wayland (WSL2, in case that matters!) imacarthur Dec 02, 2022  
 
On Friday, 2 December 2022 at 05:07:58 UTC Manolo wrote:
The single source file for the cairo plugin (libdecor/src/plugins/cairo/libdecor-cairo.c) begins
with assignments of constant variable values for the title font size, and the colors of title bar text
and background, in active and inactive states  :

static const size_t SYM_DIM = 14;      // font size

Yes - the tricky bit is that this size not only sets the font size, it also defines the dimensions of the max, min, close buttons and their symbols, so just changing this value isn't the best fix.
Rather, I think there's actually a bug in the plugin code.
Around line 2715 they have:

        pango_font_description_set_size(plugin_cairo->font, SYM_DIM * PANGO_SCALE);

but I think that is wrong, as I think that pango_font_description_set_size() expects a font size in points (72 dpi) and renders it to the display scale; but they have scaled it by PANGO_SCALE which I think *also* scales it up... Elsewhere that SYM_DIM is used (e.g. in drawing the max, min, close buttons) it is used without pre-scaling, so is in effect in Cairo display units (and hence smaller than the font will be rendered.) I think that is why the font looks too big compared to the other title bar components.

I replaced the call with:

        pango_font_description_set_absolute_size(plugin_cairo->font, SYM_DIM * PANGO_SCALE);

instead, as that will render the font in "display units" rather than points, and that certainly looks like a more credible size in my tests.

 
static const uint32_t COL_TITLE = 0xFF080706;     // background color - active
static const uint32_t COL_TITLE_INACT = 0xFF303030;  // background color - inactive
static const uint32_t COL_SYM = 0xFFF4F4EF;    // text color - active
static const uint32_t COL_SYM_INACT = 0xFF909090;       // text color - inactive

Yes - what I was hoping for was that we could do something like call Fl::get_system_colors(); to determine what these values should be, then set them based on that (though with some remapping since our colours are *not* the same format as this...) But calling a fltk C++ method from a plain-C plugin loader may not be ideal here...
 
Developers are welcome to commit changes to these values to create what could be an FLTK-style
title bar. Change should be labelled with a comment to allow transmission of these
changes whenever the source file would change upstream.

Yes - since we load the built-in via our fl_libdecor-plugins.c wrapper, we can tweak that to pull in a modified+renamed copy of  libdecor-cairo.c (say libdecor-cairo-modified.c or whatever, better name suggestions welcome!) and put any tweaks we fancy in there without altering the upstream code at all.

--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/6b282c6a-3507-4658-bcfc-d06b38542c29n%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.