Skip to content

Commit

Permalink
Flush pending events before opening pipe to zenity
Browse files Browse the repository at this point in the history
Mouse clicks are ignored when we open a pipe to zenity without flushing
the pending X11 events first because popen stalls aseprite execution until
we selected a file.
  • Loading branch information
Joefish authored and dacap committed Nov 3, 2023
1 parent 226f74c commit d5a724c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions os/x11/native_dialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "base/replace_string.h"
#include "base/split_string.h"
#include "os/common/file_dialog.h"
#include "os/x11/x11.h"

#include <cstdio> // popen/pclose()
#include <cstring>
Expand Down Expand Up @@ -139,6 +140,9 @@ class FileDialogX11 : public CommonFileDialog {
// between the given "parent" argument in this show() function
// and the created window by the utility.

// Flushes pending events to the X Server, so that input does not
// get stuck when opening a pipe to zenity.
XFlush(X11::instance()->display());
// Here we run the command and get a handle to read its
// stdout.
FILE* f = popen(cmd.c_str(), "r");
Expand Down

0 comments on commit d5a724c

Please sign in to comment.