thezbyg / gpick

Advanced color picker written in C++ using GTK+ toolkit
BSD 3-Clause "New" or "Revised" License
376 stars 33 forks source link

Problem in paradise on arch.. #204

Open Jirido opened 2 years ago

Jirido commented 2 years ago

Hi. First of all I love your program! Well thought out. While trying to install the AUR package https://aur.archlinux.org/packages/gpick-git it becommes obvious that it don't install gpick needs lua with c++ it seams.. (remember I am totally ignorant but just .. well..) So I went to #archlinux as usual to ask and got to know. Arch has no lua-c++ package either in repo or AUR.. But omegatron wrote a manual on how to get it up and running. It is on gpic-git's AUR page, but it looks wild thou. I thought it could come in handy..

But he also Said: it installs now and runs, but immediately crashes with : gpick: cairo-surface.c:1733: cairo_surface_mark_dirty_rectangle: Assertion `! _cairo_surface_has_snapshots (surface)' failed.

I just thought you should know.. whom knows this things.. Maybe you can fix this?

I hope to be able to run gpick 0.3 soon and live in the hope.. Also maybe we some day get an lua-c++ package and don't have to balance like dancing dare devils on the edge to get gpick.

omegatron:

   keep in mind, whenever it's necessary, a command might be run as root

--   |     | #   also, I normally do a DESTDIR installation with '/tmp/destroot' as   | #   target directory   |    |     |     | #   lua 5.4.4   |     | #   this section is almost the same as Arch's for 'plain' lua-5.4.4   | #   I just add 'CC=g++' to two commands ;   | #   and of course need to patch and rename the .pc (pkgconfig) files   |     | patch -p1 -i ../06-Patches/liblua.so.patch   |     | sed "s/%VER%/5.4/g;s/%REL%/5.4.4/g" ../06-Patches/lua.pc > lua.pc   |     | make MYCFLAGS="${CFLAGS}" MYLDFLAGS="${LDFLAGS}" CC=g++ linux-readline   |     | make \   | TO_LIB="liblua.a liblua.so liblua.so.5.4 liblua.so.5.4.4" \   | INSTALL_DATA='cp -d' \   | INSTALL_TOP=/tmp/destroot/opt/lua/5.4.4 \   | INSTALL_MAN=/tmp/destroot/opt/lua/5.4.4/share/man/man1 \   | CC=g++ \   | install   |     | ln -sv /opt/lua/5.4.4/bin/lua                /tmp/destroot/opt/lua/5.4.4/bin/lua5.4 ;   | ln -sv /opt/lua/5.4.4/bin/luac               /tmp/destroot/opt/lua/5.4.4/bin/luac5.4 ;   | ln -sv /opt/lua/5.4.4/lib/liblua.so.5.4.4    /tmp/destroot/opt/lua/5.4.4/lib/liblua5.4.so ;   |     | install -Dvm644 lua.pc /tmp/destroot/opt/lua/5.4.4/lib/pkgconfig/lua54-c++.pc   |     | ln -sv lua54-c++.pc /tmp/destroot/opt/lua/5.4.4/lib/pkgconfig/lua-c++.pc ;   | ln -sv lua54-c++.pc /tmp/destroot/opt/lua/5.4.4/lib/pkgconfig/lua5.4-c++.pc ;   | ln -sv lua54-c++.pc /tmp/destroot/opt/lua/5.4.4/lib/pkgconfig/lua-5.4-c++.pc ;   |     | mkdir -pv /tmp/destroot/opt/lua/5.4.4/share/doc/lua-5.4.4   |     | install -vm644 doc/.{gif,png,css,html} /tmp/destroot/opt/lua/5.4.4/share/doc/lua-5.4.4   |     | sed -e  's|-lm|-lm -lstdc++|' \   | -i  /tmp/destroot/opt/lua/5.4.4/lib/pkgconfig/lua54-c++.pc   |     | #   the following is important, so that 'ld' might find this lua   |     | mkdir -pv /tmp/destroot/etc/ld.so.conf.d   |     | echo /opt/lua/5.4.4/lib > /tmp/destroot/etc/ld.so.conf.d/lua-5.4-c++.conf   |     | #   run 'ldconfig' as root   |     |     |     |     |     |     |     |     | #   gpick :   |     | #   this one is somewhat picky and 0.3, after being installed, aborts when run immediately ;   | #   might want to try this with a more recent checkout ...   |     | git clone https://github.com/thezbyg/gpick   | git checkout v0.3   |     | mkdir -pv build   | cd build   |     | cmake -DCMAKE_INSTALL_PREFIX=/usr ..   |     | #   the final link commands would fail, without this patching (i'm no cmake expert ..)   |     | sed -e 's|lexpat|lexpat /opt/lua/5.4.4/lib/liblua5.4.so|' \   | CMakeFiles/gpick.dir/link.txt \   | >   CMakeFiles/gpick.dir/link.txt.new   |     | touch -r CMakeFiles/gpick.dir/link.txt{,.new}   |     | mv -v CMakeFiles/gpick.dir/link.txt{.new,}   |     |     | sed -e 's|lexpat|lexpat /opt/lua/5.4.4/lib/liblua5.4.so|' \   | CMakeFiles/tests.dir/link.txt \   | >   CMakeFiles/tests.dir/link.txt.new   |     | touch -r CMakeFiles/tests.dir/link.txt{,.new}   |     | mv -v CMakeFiles/tests.dir/link.txt{.new,}   |     | #   now compile as usual   |     | make -w -j 16 VERBOSE=1   |     | make -w -j 1 DESTDIR=/tmp/destroot install

thezbyg commented 2 years ago

Hi, I can't reproduce this issue on my system, but found reports of similar problems in other programs and they were caused by missing cairo_surface_flush() call before calling cairo_surface_mark_dirty_rectangle(). I have no way of testing this because on my system everything works with and without cairo_surface_flush() call, so please try rebuilding with the following patch applied and report if this fixes your issue:

diff --git a/source/ScreenReader.cpp b/source/ScreenReader.cpp
index 5c06ca3..16afa39 100644
--- a/source/ScreenReader.cpp
+++ b/source/ScreenReader.cpp
@@ -67,6 +67,7 @@ void screen_reader_update_surface(ScreenReader *screen, math::Rectangle<int> *up
                std::cerr << "can not get root window surface" << std::endl;
                return;
        }
+       cairo_surface_flush(rootSurface);
        cairo_surface_mark_dirty_rectangle(rootSurface, left, top, width, height);
        cairo_t *cr = cairo_create(screen->surface);
        cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);