Re: Scintilla GTK 4 port
Neil Hodgson <[email protected]> Thu, 20 Nov 2025 22:22:32 +1100
| Newsgroups | gmane.comp.lib.scintilla.devel |
|---|---|
| Message-ID | <CACWkrThPeBtATHK=1O5vFduQgEd-NwnG1hh0oFbVGqW+J-tJsQ@mail.gmail.com> |
Sergey Bugaev: > Between these two, GTK behaves closer to Cocoa, in that > application/widget level coordinates are in logical pixels/units, > which are then scaled inside the toolkit to get to physical/device > pixels. This way, most of the application code never has to care about > the details of scaling (other than shipping icons with a larger > resolution etc). Since Windows allows fractional scaling, I'd say that GTK4 is more similar to Windows than Cocoa. To minimize difficulties now and with applying future changes, it could help to make this platform layer behave as much as possible like Windows. Windows is the most popular platform for Scintilla, accounting for most of the users and developers with Linux and macOS minorities. Linux is further split into GTK and Qt, wxWidgets, Tk, and other toolkits. To avoid seams, the scale of the drawing context could be changed to ensure that Scintilla is again addressing whole pixels. That would then need to be balanced by changing font creation to invert that scale so text appears the expected size. > Yes, so we of course have to keep compatibility with applications > forcing specific colors and fonts, if they do. > > The issue with this (as it's always the case when a specific color is > provided instead of going through the style sheet mechanism) is that > it won't (without additional work on each application's side) follow > system settings like dark mode, accent color, high contrast. Applications and users really do implement detailed control over styling with themes and complex style configuration dialogs. This is one of the main reasons that applications choose Scintilla. There are often between 20 and 100 individual styles set by a language mode with many distinct colours. > GtkSourceView has pairs of light/dark styles for this, and uses the > accent color for selection. Using the accent colour for selection is currently possible on Cocoa. It is a bit more complex there as Cocoa allows the user to set different accent and selection colours. Selection background colors on Cocoa go through the elements system which also allows the application to override the colours if desired. See SC_ELEMENT_SELECTION_BACK and ScintillaCocoa::UpdateBaseElements which is responsible for reflecting user preferences and changes to these. There are 5 selection background colours currently defined by Scintilla to allow differentiating additional (and secondary) selections and to choose a different appearance when the window does not have focus. > There are libraries in the platform whose API was not designed with > introspection and language bindings in mind, and this is seen as a > deficiency. There is a lot of code in the gtk4 directory to support introspection and wrapping the API: 130K for enumerations in ScintillaEnums.[ch] and around 22K for a partial API wrapper. For Qt there are separate directories for ScintillaEditBase and ScintillaEdit (which includes an API wrapper) so that it was easier to understand and modify the base functionality. > I just tried building this on Ubuntu 25.10, using their provided > toolchain, and the packages you listed, and I only get some > "-Wincompatible-pointer-types" warnings (when building the demo, not The actual failure was not finding the scintilla library and that was due to building inside the ScintillaDemo directory instead of gtk4. It is working now. > fill out more metadata for the project (see gi-docgen doc page [3]) > such as authors and license. There should also be a mention of the license in the source code files. All source code distributed with Scintilla uses https://www.scintilla.org/License.txt . It is OK to add additional license possibilities (as Sun did for files in the cocoa directory) but everything (distributed from scintilla.org) must also allow use with the main license. Neil -- You received this message because you are subscribed to the Google Groups "scintilla-interest" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/scintilla-interest/CACWkrThPeBtATHK%3D1O5vFduQgEd-NwnG1hh0oFbVGqW%2BJ-tJsQ%40mail.gmail.com.