-
Notifications
You must be signed in to change notification settings - Fork 0
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
initial conversion to gtkgestures ("gtk4") and other experiments #30
base: master
Are you sure you want to change the base?
Conversation
3784a4b
to
c4fcd6f
Compare
@TurboGit @jenshannoschwalm @ralfbrown Started an experiment with preparing to migrate gtkbox to gtk4. Again, due to all other gtk related changes here, it made more sense to base it off this "fork". Gtk4 doesn't have the child expand/fill flags anymore that get passed in darktable/src/imageio/storage/piwigo.c Lines 1149 to 1158 in c4fcd6f
To me this new approach would be beneficial even if the migration to gtk4 never happened as it makes defining "standard" ui widgets easier. (I'm sure the more complex ones and very tailored dialog boxes will still be a hassle, as they were before). The commit "prepare to migrate box" shows a set of examples of what this conversion would look like, but of course there's no point in progressing this further if there is no interest. |
I'm about to disappear for two months due to work, but wouldn't mind looking at it again in spring/summer 2025. |
|
Not doing a PR, no. Please feel free to cherry-pick whatever you like. I have rebased the maintenance work, but I haven't at all checked if it is still "complete". I.e. if they old patterns have been reintroduced with recent commits, they'll have to be cleaned up again. Also, there's probably more maintenance to do... I've just been doing the gtk stuff on top of this because there's so much dependency/overlap, but really for gtk3 cleanup/gtk4 preparation I'm just playing around and giving some suggestions on how this could be done without simply doing a line-by-line translation, which would lead to a very inefficient end result. Really, some stuff needs to be redesigned to take advantage of improved gtk4 stuff rather than setting the current status quo in stone. For the gestures, for example, since everything needs to be fixed anyway, why not think about how left/right/ctrl etc clicks (and touch support) really should be done and then implement that everywhere consistently. Looks like popup menu's will need a lot of work too, so same there. |
src/iop/overlay.c
Outdated
@@ -250,8 +250,7 @@ static void _clear_cache_entry(dt_iop_module_t *self, const int index) | |||
} | |||
|
|||
static void _module_remove_callback(gpointer instance, | |||
dt_iop_module_t *self, | |||
gpointer user_data) | |||
dt_iop_module_t *self) |
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.
Would you comment on this ? We reduce number of parameters - superfluous?
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.
overzealous :-)
According to the signal signature, the user_data
parameter should be there. But since it (currently) isn't used, there is no impact.
tbh don't know what I was thinking (if anything) when I edited this, except that in this case the "self" parameter is confusing, since it is actually the first parameter passed from develop.c
when it throws the signal DT_SIGNAL_DEVELOP_MODULE_REMOVE
and the user_data
parameter is the real self
(i.e. the overlay module) set by DT_DEBUG_CONTROL_SIGNAL_CONNECT
.
So, I may be completely mistaken, but it looks to me that this handler tries to interpret any module being removed as if it was an overlay and looks up the imgid
field (which would mean something completely different in another module's blob) and if it happens to be a valid id and used in an overlay, it will be dt_overlay_remove
d (which might be bad?). If however this is the current module being removed, then it probably does the right thing. I imagine there will be a bug when there is more than one overlay module and only one of them is removed, but haven't tested because I don't know what the impact of dt_overlay_remove
is supposed to be.
@TurboGit ?
What doesn't help here is that the definition of in DT_SIGNAL_DEVELOP_MODULE_REMOVE
in signal.c
is actually marked incorrectly with DT_SIGNAL_MODULE_REMOVE
, so not easy to find. This is fixed in 85956e1
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.
In intensive care a overzealous doc is likely harming :-)
As this signal is special
to this module i think self/user_data will always be a ptr to an overlay ...
Yes i have seen (and tried the signal fixing commit). This PR is by far large enough to be reviewed. I looked at my watch while enjoying and keeping concentrated , 2.5 hrs :-)
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.
btw bit confused by your comment in PR additional fixes commit "A few places where i think we should keep the checks for allocations even if allocations errors are very unlikely due to requested size." since I don't see those removals in my "local" PR. Maybe they were introduced by rebasing/cherry-picking (which is always tricky/dangerous)?
You did a very good read-through to catch all the other fixes!
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.
In intensive care a overzealous doc is likely harming :-)
You are absolutely right and that's exactly how I meant it! ;-)
As this signal is
special
to this module
It isn't? It is sent to history.c
for any module being removed.
i think self/user_data will always be a ptr to an overlay ...
user_data
yes, but not the second ("self") pointer. I suggest changing this to
static void _module_remove_callback(gpointer instance,
dt_iop_module_t *removed,
dt_iop_module_t *self)
and fixing the code accordingly. Probably by adding a check removed == self
, but that's up to @TurboGit
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.
Isn't overlay the only module asking to receive it - at least in current code?
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.
$ grep CONNECT.*DT_SIGNAL_DEVELOP_MODULE_REMOVE src -R
src/iop/overlay.c: DT_DEBUG_CONTROL_SIGNAL_CONNECT(darktable.signals, DT_SIGNAL_DEVELOP_MODULE_REMOVE,
src/libs/history.c: DT_DEBUG_CONTROL_SIGNAL_CONNECT(darktable.signals, DT_SIGNAL_DEVELOP_MODULE_REMOVE,
Those 2.5hrs must have been exhausting... ;-)
EDIT: or in case you meant only iop module; it still means that each overlay instance receives this message for each module being removed. It doesn't just receive it if this module itself is removed. So simply looking if the removed module is an overlay (or whether the random number in its params that happens to be in the same spot as the imageid in an overlay module is a valid imageid) is not sufficient.
Or maybe I'm just completely confused in which case just ignore me; I haven't looked at, or used, overlays myself.
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.
Well your work certainly took longer... It's just if I push that PR I wanted to be certain about what's happening.
Will check the overlay code an propose a correct solution.
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.
Nice, Pascal has merged that big first part....
Just a note: your signals work (rebased on current dt code so minor "missings") has also been merged |
Diederik, as you won't do the pr i cherry-picked the remaining 3 commits to a local branch, rebased on master without any changes, and tested here. Could not spot a single issue! Also read through the code, for a non-gtk-speaking person like me it seems to me we reduce and simplify code significantly so for sure it's worth to integrate now, whoever might work on progress to gtk4 (definitely it won't be me and from the commit history related to gtk i fear you are the person knowing by far most how that could be done :-) I feel a bit uneasy yet about pushing the PR as i might not be able to fix resulting issues or even discuss details. I would certainly need your support! Give me a "GO i will assist" before opening. |
These GTK4 experiments are just that; experiments. They give an indication of how much work is involved and might give somebody inspiration to get involved. But this should be someone who really knows gtk3&4 and has a thorough understanding of how darktable works and ideally how it abuses gtk to do it. But very few people do anymore, so it may just need somebody to spend a lot of time getting up to speed. It is impossible to test changes if you don't understand how the program is supposed to work; quite often the effects of a ui interaction happen somewhere quite invisible. So imho merging the commits here is pointless because most of the similar cases have not be converted yet and the way development (especially gtk/ui related) in darktable happens is that the non-converted cases will continue to be copied over. I toyed with the idea of submitting this as a draft PR marked "RFA" (request for adoption). That would possibly give a somewhat larger chance that somebody will get involved and do the remaining work. But tragically the open PR list gets hardly any attention from anyone besides the three core developers, so I'm not holding out high hope. For this reason I do not believe that a full gtk4 transition has any chance of happening. For fun I pushed one additional commit here that makes it possible to compile the codebase with Gtk4 instead of Gtk3 (after installing the necessary development libraries, obviously. I've only tested this under debian). Any deprecated/removed calls have been defined as macros in darktable.h so that they don't break compilation. Obviously it immediately crashes when you try to run the resulting binary. But at least this gives some idea of how many different aspects of the codebase need changing. Any of these functions should not be robotically be replaced by their "equivalent" gtk4 version but instead should be restructured to take advantage of new approaches or simply because old workarounds might not longer work or be needed.
I am still not planning on getting involved to that extend. In hindsight I consider submitting darktable-org#17451 to have been a mistake. |
That means that darktable will not be available in some years from now. So I hope for the opposite :) |
I'd like to have hope too, but it is unreasonable to base that on the efforts of one burned out developer. I've indicated what I feel would be required to achieve the goal. It is not impossible for new people to learn gtk, if they are willing to put the effort in. It doesn't require expert level to take the recipes I've suggested in this PR and apply them to the rest of the codebase. I've tried in my past PRs to provide explanations for people to learn along, but have no idea if anybody ever read them. Similarly, anybody can be involved in testing and feedback. But the attitude on github and pixls always is "I'll test it when it's done" and then I'll offer my superior insight and opinions. That may work for smaller enhancements, especially when one is in a position to ignore the feedback and merge anyway, but not for a two year effort. Have you looked at darktable/src/common/darktable.h Lines 1315 to 1556 in 1368824
|
@jenshannoschwalm in case you are wondering which changes in ancil are just for my own use and entertainment and which should be generally applicable, I'm listing the relevant ones below: straight up bug fixes code base improvements Uncontroversial (probably) functionality improvements/additions Opinionated improvements |
I am surprised i didn't find the reverts in the last part of the list :-) Just opened a next PR. IIRC we discussed this
before. I thought about it and tested again, you seem to be right, that invalidate is indeed not required. |
Those undo an intentional and democratically decided action to break the carefully designed behavior that was intended to gracefully deal with (initialising and switching between) displays with wildly different resolutions (laptops and 4k screens). I like my vectorscope circles and navigation thumbnail to have constant aspect, but if the majority want to adjust their width and height separately, and do it each time they connect an external monitor, I have no desire to get in their way. That's the beauty of maintaining a "fork" for personal use; it's easy to build something exactly to your own liking. Of course there is the little extra hassle of having to revert each fix for now inconvenient behavior in mainline separately too, but it is a very small price to pay. Please don't, in my name, push anything upstream to change this. Similarly, I did not list "click on expanded but unfocused module grabs focus" as ready for upstream inclusion. I think that's a personal preference and both approaches have drawbacks. It's only in my personal workflow that my local behavior makes more sense. If the PR gets merged as is, in a few months' time you will get people complaining about breakage and bisect will point at a commit with my name. You could label that PR with default-behavior-change, but it's not really just a default. "mirror map cursor keys from darkroom" is somewhat different, in that I believe that a lot of what people call "intuitive" is actually just "consistency". When CTRL almost everywhere (as far as I've noticed and fixed) means smaller moves, then in this one specific case using it to make larger moves has the potential to break people's motor memory and mistrust their "instinct" everywhere else in the program. I think this is "bad". Also, implementing the feature as a move action with fallbacks, rather than as hardcoded commands, means that it is fully customizable; you can change the step size or add other modifier combinations and you can assign up/down or left/right moves to, for example, a midi knob in one step, automatically inheriting the shift/ctrl speed adjustments. Of course nobody cares about arrow keys in the map view, so it is largely irrelevant, but to me it's the principle that details matter. I'm still somewhat sad about giving in to making "no fallbacks" the default. It means a lot of people will not benefit from the extra functionality this makes automatically/easily available and makes it harder to assume the same behavior for everyone in documentation. But then, some people don't really want flexible shortcuts and see them as a potentially dangerous inconvenience. I think ansel has mostly stripped them out completely for months now and people there seem very happy about it. More power to them! |
Absolutely not intention to do so and i am fully aware of the decision process - i think i also commented. Ok, i'll remove the "focus" commit from the PR. Next time i will make me the author so blaming me would be the result. ok? EDTI: Would you want me to take "ownership" whenever i open a PR with your work so blaming/bisecting would be on me? (Maybe you told me already and i forgot) |
How do you know what people think? For sure AP strongly disliked it so i guess that's why it got removed. I sometimes had a look what he was doing in github and couldn't spot anything noteworthy. No idea how stable ansel is now. |
You are doing the integration work so it would only be fair to take the credit. And then people also would know who to turn to for fixes/changes. But tbh it doesn't matter too much to me, so just do what is less work. And not doing contentious stuff saves a lot of work :-)
Anybody who hasn't left yet or continues donating must be happy with the decisions? I'm all for choice and for giving people who don't like dt's direction other options than just complaining.
Some of the stuff he does with the cache is "interesting", but his approach often breaks things because they were "stupid" when really the basic design of the cache never meant to support everything that is done with it now, so workarounds are necessary and the only real solution is a full redesign (after analysis of all current, and likely future, use cases). A lot of work but chasing down each individual breakage is work too and unlikely to improve performance in the long run. |
Yes , also saw his work on cache. From what I understood he mainly removed the code... May be wrong |
Added another commit to ancil (04d2e7a) inspired by 13e2050 and many like it. There's obviously the possibility that people were using "partial" It is also reasonable to conclude that this horse has bolted and that large trivial refactorings like this are just not worth it. |
I check all changes, seem to be worthwhile. I also made sure, a log line doesn't end with a dot - some did, most not. Will pr this in combination with the also-many-files-touching "dt_util_str_cat" (BTW your commit included changes in lua scripts, i left that out as it would of course require mods in that git. |
I hope you especially checked for |
Indeed i missed quite a few, new pr. I think now were done with newlines. |
|
Either some device (mouse, pen, whatever) is physically removed from the system or, more likely, memory is getting corrupted causing a tool driver to fail and remove itself. I find the mention of Unclear to me "RAM fills up completely. This status takes very long time" is he talking about a slow increase in memory use (i.e. is there a leak somewhere) or just an immediate increase because he's using (two) large diffuse models? If it used to work before, he could try installing an old nvidia driver. |
It seems his issue is not related to opencl only. In the bluescreen log we can find this
before the Likely due to running two thumbnail pipe in parallel thus doubling consumption not checked in dt pipe processing. |
I just saw Let me know if anything of those seem to be |
You know unbridled duplication, especially cases like this where large chunks of code need to be kept in sync, is one of my bugbears. So I can't help myself "fixing" them when I come across one. But there's really no point because new cases are committed into the codebase faster than anybody can keep up with.
I think this works, but I may not be aware of other cases where the result of a pipe run could cause a need for refreshing the sliders (since AI was removed). Also, of course haven't tested reenabling AI again with this change.
There's a bug when clicking on the histogram while the exposure module sliders haven't been realized yet (i.e. they haven't been shown at least once). This causes the colour picker to be enabled (since width = 0 the click is always in the right-most area). Should be easy to fix but haven't prioritised. Personally I would prioritise |
Just didn't look into that in detail. |
Maybe a riddle you can solve quickly. If i stop darktable by click-on-close-button pretty soon after start i regularly observe this. We try to join pthreads in a bad situation. Any idea?
|
Solved now. It also reversed the direction of a drag. All working now (even when right panel hidden (and histogram is shown in the left). Ready for your testing! I've also added a toast of the resulting value/the affected slider, like you get when using shortcuts. |
Seems you are able to interrupt |
Mmh. It's set to FALSE via calloc initially.
Will do the next days for sure and also the snapshot-difference thing. Just need to cleanup my git branches first due to demosaic cleanup and capture sharpening otherwise i won't be able to keep everything "safe" :-)
I personally don't think it's that bad atm. Although i confess, besides pipe things i don't look into PR details... |
@TurboGit not sure what you expect in 17784. This is intended as a simple tool to quickly check if there aren't any unintended large differences or unevenness in large impact areas. If there are, switch back to normal snapshot comparison to zoom in and see if they are good or bad; you can't really judge that in the diff. If there aren't any large differences, then indeed the diff will be dark. You could scale that, but you'd have to be able to adjust it, so large difference areas don't get blown out. Now you are creating a complex tool that people use infrequently which is a ui and bikeshed nightmare causing a lot of wasted time down the line. Then it would be better not to include it at all and spend the time perfecting the clock in the splash screen. For in depth analysis it might be better to use blend mode "difference" to highlight impact of a module. Then you should be able to easily apply a curve module after to zoom into specific ranges of subtle differences. |
I took the image from the integration test and just enable the "local contrast" module. This is quite visible on the image, but the display is: I would have expected something like this: I just took dt and have added 3EV exposure and curve with contrast in shadows. EDIT: Done quickly and so probably too much here. |
If I compare the snapshot diff with a blend mode=difference (on the local contrast module) then it is indeed a little bit dimmer, but not as extreme as your example. So cairo may be using a slightly different blending algorithm or it may be a color space effect. But if you increase the "detail" slider you quickly see a much more pronounced diff. So I'm not sure there's anything wrong. It behaves more or less as I expect. Again, the intend is to quickly check if there are no unexpected large differences anywhere (much easier to see against a mostly black background than in a possibly very detailed image). I have no intend to build a complex analysis tool (that isn't needed because there are ways to do such analysis with much more control already). If you think that makes the option useless, then I suggest @jenshannoschwalm drops that commit from the PR or closes the PR completely. As I have stated a few times now, I have no intention to have my name linked to anything contentious anymore (and anything where different people might have different ideas of what is "correct" quickly becomes contentious). |
Yes, my point is that if you need this shift-click to see the diff it is probably because it is somehow subtle and difficult to see otherwise on the image. So I think we need to have some stronger contrast in this case. |
If you make it brighter for small subtle differences then you blow out big differences. You'd have to make that configurable. Now you need to add shortcuts or modifiers and make them discoverable and not clash with anything else. If you maintain state between invocations, people won't remember they changed something sometime so you need to remind them. @jenshannoschwalm please drop the commit from the PR because l don't see a path forward for it that doesn't involve much more waste of time (now and in future maintenance) than this gimmick is worth. Thank you! In fact, the other commit has a similar "subtlety" issue, and the people that I'm dreaming might notice it to realize the flexibility of the shortcut system are probably exactly the kind of people who don't pay attention to such details, so probably not worth keeping that either (because it will trigger requests to make it configurable via CSS or whatever). |
But big differences are already visible on the standard view. My point is really that this "diff" view is more for subtle changes. No? |
No. It is meant to spot unintended larger changes in areas of much detail where they would be sometimes hard to spot if there are many intended large changes everywhere too. I wonder how you intend to judge whether small changes are good or bad in a diff rather than the full image? The diff is certainly not meant to encourage pixel peeping there.
Edit: I'm not saying that it wouldn't be nice to improve contrast if there are only small changes. I was asking if you thought through what that means for large changes and the user interface. I'm not hearing what exactly you would want to happen. Like, what would the end state of the tool be like, in your opinion. But I'd rather stop discussing it because in any case, I'm not going to spend time on "improvements". |
Will close the PR. I'm fully aware btw that all improvements would not work for me, if there is more UI complexity. Also work would be on my side. And no room for User-Tuning, i'm also not interested in that. |
Replacing #29 which became a mess due to rebasing.
This started as a general regexp cleanup to reduce boiler plate in pointer casting (especially in event handlers).
But then I wanted to experiment with transitioning to gtkgestures in preparation for gtk4 (and also to improve support of touchscreens under gtk3). Since there was so much overlap (in the function prototypes) I continued in this branch.
Obviously this has parallels to darktable-org#16919. So what are some of the differences?
g_object_weak_ref
. The final port to gtk4 would simply adjust the code indt_gui_connect_...
to usegtk_widget_add_controller
instead.claim
the gesture in order for it to stop propagating (otherwise a right click on a graph might delete a node and call up the presets menu) and to receive further (double) clicks or releases. This also clearly shows the danger when migrating; signal handlers are always cast toGCallback
so there is no typechecking that catches changed interfaces. This only shows during testing when functions either malfunction or crash.GtkGestureMultiPress
in the signal handlers, because gtk4 renames it toGtkGestureClick
so a final port would have to revisit everything again. Instead, the signal source is passed as a pointer to one of the parents (GtkGesture
orGtkGestureSingle
, depending on what is convenient). In many cases, rather than continuing to use fields of theevent
object directly (after retrieving it usinggtk_gesture_get_last_event
), which will not work anymore in gtk4, alternatives have been used (where their API will be stable). For example using thex
andy
signal arguments, rather than event fields.This very limited first step clearly shows how much work is involved. Though there is already an improvement in touch screen behavior (tested/tried only on Windows) clearly much more porting needs to be completed before it becomes useful. However, at the same time it seems infeasible to maintain this as a separate PR. Merges like darktable-org#17161, besides being mostly unnecessary, cause significant work in rebasing.
Deprecated modules will have to be converted too (and have been, in this limited PR), but testing them is not easy (and won't happen organically before/after merging a PR). "Luckily" a lot of the graph/curve code has been copy/pasted between modules, so much of the conversion was done on the auto pilot and has at least some chance of working.
What this exercise, as many of the previous ones I've worked on, also clearly shows is that any large maintenance work on the codebase benefits from a lot of cleanup work first. Especially deduplication/refactoring and coding style uniformity massively help (and actually are where most of the work goes). Often patches have been applied over patches, when refactored code might have been much more trivially ported. For example some of our custom widgets could have sent their own custom events rather than linking to standard gtk button press/release events (which is often done to catch modifier settings from the
event->state
, which gtk4 does not allow). I'm specifically thinking ofGtkDarktableToggleButton
which could support control&shift/right-click/long-press features directly rather than letting all the users deal with it (and possible touches as well). However, restructuring while porting introduces more opportunities for errors to creep in and mindlessly converting 10 cases is often faster than first unifying them and then converting once. Perpetual technical debt.@TurboGit I know you are currently very busy so don't expect any in-depth response, but are you at all interested in this PR even in this limited format? It would have to be prioritised over other PRs that touch significant gtk code in order to be manageable.
@jenshannoschwalm @ralfbrown included you both to see how much interest there would be to carry this forward. Clearly this is not a one man effort (or at least not this man).