-
-
Notifications
You must be signed in to change notification settings - Fork 620
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
GUI backends phase 1 #664
GUI backends phase 1 #664
Conversation
d0e216b
to
233a875
Compare
Hmm, the font stuff also needs work it seems. |
Wow, this is an epic PR. Thank you for the work. It sounds like this is still a work in progress, so I will let you continue, but please let me know when you think it's time for me to take a closer look. |
src/display-console.cc
Outdated
* | ||
* Please see COPYING for details | ||
* | ||
* Copyright (C) 2010 Pavel Labath et al. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this to Copyright (C) 2018 François Revol et al.
here and elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I'll include it in my next round.
215cb8e
to
413639b
Compare
Second round: Not much more, mostly cleanup of history and code. |
95993aa
to
2120049
Compare
@mmuman For macOS if you include |
Ok.
Thanks, I'll have a look. |
Another round: autosquashed all the fixup commits. Also moved the accessors around as I'll probably need them in font code. |
Where do we stand now on this? Ready for a review? |
I was quite busy with work so I still didn't touch the font stuff, I'll try this week. |
I had another look at the font code, and I'm not sure how best change it:
Also, it seems like xftalpha is applied only to the first font, is it an oversight or intended? |
Ok, I managed to fix the only thing left that was holding the cleanup up (crash on config reload). |
Looks like including < vector > in display-output.cc isn't enough, clang complains… |
and we need #include algorithm for sort()… |
Hopefully this will lead the way to adding support for things like Wayland and Haiku graphics, cf. brndnmtthws#56. We define a display_output_base class that display backends can derive from to implement display-specific calls.
We already do this like with HTTP+stdout.
Some leftovers still, but it still works.
we want to be able to access either all outputs, or the currently selected one (if any, else return the top one, which ought to be the GUI one if we have one).
Still some things to sort out, but seems to work. A lot of variables and calls had to be made non-static.
Backported from 308f2cb
unused paramaters and (un)signed comparison mostly.
Since we rely on a global object ctor to add a display output to the list, it is not referenced from anywhere else, so does not get linked in when building tests since most objects are pulled from a static library. Another option would be to use --whole-archive to link to it.
fcba98e
to
fdd478e
Compare
good idea to bump the version before such a big change btw. |
I'll leave that up to you. Squashing will keep the history a bit cleaner, but if you don't squash then you'll get credited for 23 commits in one merge. |
Since we still have things to fix I though it'd be useful to have the full history, but I'll take the |
Thanks so much for this PR @mmuman and @brndnmtthws |
Getting there. Anyone experienced with profiling who'd want to compare before/after? |
This is my first attempt at trying to sort out the X11-specific code from the rest, and allow implementing other display backends, to help with Haiku port, Wayland (#56), or Metal (OSX)…
It's mostly working but not really finished. The last commit kept the original code around with changed ifdefs for easier comparison until it's done, and I'll keep amending it for now.
I'm not used much to templating in C++ so maybe the classes look a bit naive, but I believe it's a reasonable implementation (maybe using templates would avoid RTTI and speed things up, I don't know, but I'm not confident enough to try it).
I'm not used to non CamelCase class names, but oh well.
I'm open to comments and suggestions.
Some details:
BUILD_GUI
define is declared when eitherBUILD_X11
or any later added GUI backend is enabled.conky.cc
are a bit uncertain. First I wanted to just loop over each of the displays, but then part of the code actually assume graphical output, or not. So it's still a mixture offor
loop oncurrent_display_outputs
and calls todisplay_output()
. Indraw_stuff()
I call[un]set_display_output()
to make sure the display we're drawing to is the graphical one. Although in theory it's the highest priority, so the first on the list, so always the "current" one. So this part can probably be simplified.initialize()d
, the other one would still have the settings on and so the window created…cairo_surface_create()
call. Else it means having to fix all scripts for other platforms. We'll likely have to provide fake calls on other platforms to mimic the X11 API for compatibility anyway.I think most backend methods should just return void actually, the bool is useless.DONEfonts.clear()
call when not using X11 is a bit weird, and not easy to do properly from a backend that's not been initialised. Why initialize fonts if we won't use them…