Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repair and complete GTK3 preiview #1

Closed
wants to merge 3 commits into from
Closed

Conversation

bill-auger
Copy link
Member

significant changes:

  • fix GTK3/cairo segfault (closes sf#933)
  • complete GTK3 preview implementation (closes sf#768)
  • fix warnings -Wdeprecated-declarations

the bottom commit is the most essential - lxappearance-obconf-gtk3 is broken on any distro with a recent cairo - the obconf plugin causes lxappearance to segfault on launch

the GTK3 implementation of the theme preview appears to have been an incomplete WIP

the GTK3 theme preview did not render properly, because it attempted to mimic the GTK2 code too closely - the function which draws to the gdk-pixbuf (the return value of the drawing functions), and its GDK2 counterpart which it replaced, did not have feature-parity - i could not find a replacement which does - some of the features of gdk-pixbuf2 appear to be incompatible with GTK3

the GTK2-compatible function recycled the target gdk-pixbuf, composing the final graphic, layer upon layer, with each call - however, each call to the replacement function for GTK3, clobbered the previous gdk-pixbuf; such that the final graphic represented only the work done in the last call; and so the returned graphic was much smaller than expected

instead, this change does the incremental compositing, using cairo drawing surfaces, then finally copies the composite at once, onto the GDK pixbuf which is used by the GTK2 implementation, and returned per the 'preview_menu' and 'preview_window' function contracts)

the GTK3 preview did not render properly, because it attempted to mimic the GTK2
code too closely - the function which draws to the gdk-pixbuf (the return value
of the drawing functions), and its GDK2 counterpart which it replaced, did not
have feature-parity - i could not find a replacement which does - some of the
features of gdk-pixbuf2 appear to be incompatible with GTK3

the GTK2-compatible function recycled the target gdk-pixbuf, composing the final
graphic, layer upon layer, with each call - however, each call to the replacement
function for GTK3, clobbered the previous gdk-pixbuf; such that the final graphic
represented only the work done in the last call; and so the returned graphic was
much smaller than expected

instead, this change does the incremental compositing, using cairo drawing surfaces,
then finally copies the composite at once, onto the GDK pixbuf which is used by the
GTK2 implementation, and returned per the 'preview_menu' and 'preview_window'
function contracts)
@bill-auger
Copy link
Member Author

bill-auger commented Mar 17, 2021

oh, i should add that the deprecation warnings patch is not the most correct solution - it is much cleaner though, than littering the file with pre-processor switches - thats why ... "code review"

@wb9688
Copy link
Contributor

wb9688 commented Mar 17, 2021

@bill-auger: There is no need to change GtkFontButton to GtkWidget, because it's still a GtkFontButton in GTK 3. It's just that you shouldn't use the the get/set name functions on the GtkFontButton itself as of GTK 3.22, but on GtkFontChooser, which is an interface implemented by GtkFontButton.

As for using e.g. "_OK" instead of GTK_STOCK_OK, that would cause you to not have the appropriate icon with it and you'll have to handle translating those yourself, but you didn't call gettext's _().

@bill-auger
Copy link
Member Author

bill-auger commented Mar 17, 2021 via email

@ib
Copy link
Member

ib commented Sep 11, 2023

I don't know all the rules of the LXDE team, but you better fork for pull requests.

  1. Regarding "fix GTK3/cairo segfault": You only need #include <cairo/cairo-xlib.h>, which automatically loads cairo/cairo.h. After you change the patch, I will cherry-pick it.
  2. Regarding "full GTK3 preview implementation": The basic idea is ok, but the patch does not lead to correct previews. There are still missing parts, mostly at the edge of windows and menus. But the problem can be solved much easier and more directly. Please see https://github.com/ib/lxappearance-obconf/commit/7b7dfc37c39adfe5814cf6c7748bc6d224c40d73 and the simplification https://github.com/ib/lxappearance-obconf/commit/2e334a39ebdbcd9c10453eb691c73c078539466f, which makes the differences and similarities to GTK+2 much easier to recognize and, most importantly, provides correct previews.
  3. Regarding "whitespace and stray comments": Apart from the patch not having a proper commit message, I don't like the removal of the blank lines before #if GTK_CHECK_VERSION(3, 0, 0). I would apply the patch when it is reworked.

@ib
Copy link
Member

ib commented Sep 18, 2023

Please see:

  1. b9d45ea
  2. 7b7dfc3 and 2e334a3

ib added a commit that referenced this pull request Oct 11, 2024
Patch by bill-auger, part of his pull request #1.
@ib ib closed this Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants