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

splash screen without forced keep-above #18236

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ralfbrown
Copy link
Collaborator

@ralfbrown ralfbrown commented Jan 18, 2025

Alternative to #18230, resolves #18239, resolves #18209. I managed to eliminate the flash of an empty main window covering the splash screen.

Also a bit of cleanup, removing old commented-out code.

src/gui/splash.c Outdated Show resolved Hide resolved
@kofa73
Copy link
Contributor

kofa73 commented Jan 19, 2025

Won't this cause problems if users start editing (potentially based on outdated database contents, and then modifying darktable's database + overwriting the externally modified, not yet scanned XMP) while dt is checking if XMPs have changes that are not yet in the DB?

@ralfbrown
Copy link
Collaborator Author

The crawler is a foreground process - you can't do anything until it completes, and then you have a fraction of a second before the dialog appears in which you might be able to select an image....

Copy link
Member

@TurboGit TurboGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this PR I don't have the UI displayed at all. I'm using an external screen on a notebook.

@ralfbrown
Copy link
Collaborator Author

Does the main window show if you comment out the gtk_widget_set_visible(..., FALSE) added to gtk.c? Unfortunately, there's no portable way to send a window to the back and we've already established that unminimize doesn't work on some systems if I try hiding the main window by minimizing it....

@TurboGit
Copy link
Member

Does the main window show if you comment out the gtk_widget_set_visible(..., FALSE) added to gtk.c?

Yes, in that case I do see the splash screen and the application main windows.

@ralfbrown
Copy link
Collaborator Author

Trying a different approach to keep the main window from obscuring the splash screen. GTK docs say the raise request may fail to work with some window managers, though it does prevent visual glitches with KDE's Plasma.

@ralfbrown ralfbrown dismissed TurboGit’s stale review January 20, 2025 21:21

New commit with an alternate approach to hiding main window until ready.

Copy link
Member

@dterrahe dterrahe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two comments I thought I submitted yesterday were still "pending". Let me know if they are clear or if it would be useful for me to reformulate based on latest commit.

darktable_splash_screen_destroy();
// unhide the main window and restore its geometry to that saved in the config file
gtk_widget_set_visible(dt_ui_main_window(darktable.gui->ui), TRUE);
dt_gui_gtk_load_config();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If done in this order, I get, on windows

  • splash screen disappears
  • 1 second nothing
  • window opens in old location
  • window maximizes or goes full screen

if instead I do

    // unhide the main window and restore its geometry to that saved in the config file
    dt_gui_gtk_load_config();
    gtk_widget_show_all(dt_ui_main_window(darktable.gui->ui));
    darktable_splash_screen_destroy();

then the splash screen is instantaneously replaced by the window in its final location.
The gtk_widget_show_all and gtk_widget_set_visible(FALSE) (=hide) in _init_widgets is not needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the gtk_widget_show_all from _init_widgets restults in half a dozen assertion failure messages from Gdk, because various items in the main window haven't been realized yet (they don't get created until the main window is initially shown).

Copy link
Member

@dterrahe dterrahe Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make the code more robust by adding the appropriate checks rather than implementing more workarounds?

dterrahe@40fce3c generates no warnings for me, on debian (x&wayland, under WSL2) and windows.

Unfortunately, if dt_gui_gtk_load_config is moved before show_all, when restoring a maximized state, the application thinks it is maximized, but the window manager disagrees. Even if dt_gui_gtk_load_config is executed both before and after show_all (presumably for an "already maximized" window, maximize is a noop). So there is still a very minimal/undiscernible amount of flashing when showing the screen. But no second or so gap between the splash disappearing and the main window appearing and also no overlap.

EDIT: if you still do see assertions, please let me know which so I can look into them.

src/gui/gtk.c Show resolved Hide resolved
Since setting the main window invisible results in it never showing on
some systems, try raising the splash screen (once) to keep the main
window from obscuring the splash instead of hiding the main window.
@dterrahe
Copy link
Member

Pushed an update in 3274c28 that resolves the issue that the lighttable culling widgets are permanently attached to the central view overlay and would get unhidden by a late show_all and cover the darkroom image if started with an image on the command line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants