WerWolv / ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
44.98k stars 1.95k forks source link

[Bug] Window "blinks" by becoming blurry at intervals #1809

Open Inaflean opened 4 months ago

Inaflean commented 4 months ago

Operating System

MacOS

What's the issue you encountered?

The app blurs for a split second at mostly regular intervals (tempo is around once a second but it doesn't blur every second).

How can the issue be reproduced?

Simply opening the app and viewing it. It's more obvious in the Light color theme, but visible in all color themes.

ImHex Version

1.35.4

ImHex Build Type

Installation type

DMG

Additional context?

MacOS 13.6.6 Ventura

WerWolv commented 4 months ago

Hey! I can't seem to reproduce this on my M2 mac running Sequoia. Could you maybe record a short video that shows the problem? Also do you have any apps installed perhaps that mess with the windowing system?

Inaflean commented 4 months ago

Here's the screen recording. I have f.lux installed (makes screen more amber to get rid of blue light). I did try quitting f.lux, but it didn't help.

Oddly enough, if I continuously move the mouse, the blurs last a much shorter amount of time.

Edit: I'm on an Intel-based Mac. I don't know if that makes a difference.

https://github.com/user-attachments/assets/26bce869-eede-4f27-8e2e-4a16c8a2488e

Inaflean commented 3 months ago

I downloaded 1.35.3 and it doesn't have that issue for me. Something changed in 1.35.4 that caused the issue.

rinkjames commented 3 months ago

I've noticed the same/very similar thing. Dimming/Blurring occurs somewhat randomly when moving the mouse over parts of the UI. Also Intel mac. Also 1.35.4.

https://github.com/user-attachments/assets/5cf8d2bd-d4b0-4293-8b10-863e1497bee3

WerWolv commented 3 months ago

Could any of you git bisect the commits between 1.35.3 and 1.35.4 maybe? I can't reproduce it myself on my M2 macbook. To me it looks like when it re-renders the image, it looks correct and then macOS or whatever it is applies a bilinear filtering to it if there's no new frames submitted anymore.

There's only a small set of commits that I think could have caused it and it would be b305adb2866b3d6291ff4c5db0b2ae5186934263 and perhaps 3a99d53ba5c93e39690776037e9341f4e09b05ae

rinkjames commented 3 months ago

Could any of you git bisect the commits between 1.35.3 and 1.35.4 maybe?

I tried but I'm getting errors when trying to compile on my machine.

log.md

paxcut commented 3 months ago

is llvm supposed to be used to build on Mac OS? the build for mac in git actions uses this

       CC=$(brew --prefix gcc@12)/bin/gcc-12                                                       \
        CXX=$(brew --prefix gcc@12)/bin/g++-12                                                      \
        OBJC=$(brew --prefix llvm)/bin/clang                                                        \
        OBJCXX=$(brew --prefix llvm)/bin/clang++                                                    \
        PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig":"$(brew --prefix)/lib/pkgconfig"   \
        cmake -G "Ninja"                                                                            \
          -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}                                                    \
          -DIMHEX_GENERATE_PACKAGE=ON                                                               \
          -DCMAKE_C_COMPILER_LAUNCHER=ccache                                                        \
          -DCMAKE_CXX_COMPILER_LAUNCHER=ccache                                                      \
          -DCMAKE_OBJC_COMPILER_LAUNCHER=ccache                                                     \
          -DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache                                                   \
          -DCMAKE_INSTALL_PREFIX="./install"                                                        \
          -DIMHEX_PATTERNS_PULL_MASTER=ON                                                           \
          -DIMHEX_COMMIT_HASH_LONG="${GITHUB_SHA}"                                                  \
          -DIMHEX_COMMIT_BRANCH="${GITHUB_REF##*/}"                                                 \
          ..
WerWolv commented 3 months ago

Using clang is correct. However I think there's a bug with the llvm version from brew. It looks for the standard library in the wrong location somehow. I was able to fix it by just deleting the old version of the standard library manually

rinkjames commented 3 months ago

I was able to fix it by just deleting the old version of the standard library manually.

If you help me with the directory I should be looking for, assuming it's the same on Intel, I can try to make this fix and compile again.

Edit: I've tried to troubleshoot my compiling issues with brew's llvm, but not getting past the error I reported. Will need someone's assistance to proceed.

Inaflean commented 3 months ago

Could any of you git bisect the commits between 1.35.3 and 1.35.4 maybe? I can't reproduce it myself on my M2 macbook. To me it looks like when it re-renders the image, it looks correct and then macOS or whatever it is applies a bilinear filtering to it if there's no new frames submitted anymore.

There's only a small set of commits that I think could have caused it and it would be b305adb and perhaps 3a99d53

I'm not sure how to run git and I don't know C/C++/Objective-C. I've never compiled a program before, either. What do I need to learn in order to help? If it's something I can pick up quick, I'll try to do what I can. If it's weeks worth of learning, then I might have to learn it some other time. Unfortunately, life's pretty busy for me right now....

Thanks!

Edit: wording

rinkjames commented 2 months ago

I was able to fix it by just deleting the old version of the standard library manually.

If you help me with the directory I should be looking for, assuming it's the same on Intel, I can try to make this fix and compile again.

Edit: I've tried to troubleshoot my compiling issues with brew's llvm, but not getting past the error I reported. Will need someone's assistance to proceed.

Checking again if anyone is available to assist with debugging this.

WerWolv commented 2 months ago

Not home right now but I know what's wrong with the building process now and can fix it when I'm home

WerWolv commented 2 months ago

@rinkjames Please try again using the latest commit

rinkjames commented 2 months ago

Thanks, but I'm still getting an error on latest (see below). Latest commit won't help me compile older version for git bisect though?

-- Up-to-date: /Users/rinkjames/Documents/projects/ImHex/build/install/./imhex.app/Contents/Resources
-- Installing: /Users/rinkjames/Documents/projects/ImHex/build/install/./imhex.app/Contents/Frameworks
-- Installing: /Users/rinkjames/Documents/projects/ImHex/build/install/./imhex.app/Contents/Frameworks/libimhex.dylib
-- Installing: /Users/rinkjames/Documents/projects/ImHex/build/install/./imhex.app/Contents/Frameworks/libimhex.1.36.0.WIP.dylib
-- Installing: /Users/rinkjames/Documents/projects/ImHex/build/install/./imhex.app/Contents/Info.plist
-- Fixing up application bundle: /Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app
-- Fixing up application bundle: /usr/local/lib;/lib;/usr/lib;/Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app/Contents/MacOS/plugins;/Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app/Contents/Frameworks
-- fixup_bundle
--   app='/Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app'
--   libs='/Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app/Contents/MacOS/plugins/builtin.hexplug;/Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app/Contents/MacOS/plugins/decompress.hexplug;/Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app/Contents/MacOS/plugins/diffing.hexplug;/Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app/Contents/MacOS/plugins/disassembler.hexplug;/Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app/Contents/MacOS/plugins/hashes.hexplug;/Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app/Contents/MacOS/plugins/script_loader.hexplug;/Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app/Contents/MacOS/plugins/visualizers.hexplug;/Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app/Contents/MacOS/plugins/yara_rules.hexplug'
--   dirs='/usr/local/lib;/lib;/usr/lib;/Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app/Contents/MacOS/plugins;/Users/rinkjames/Documents/projects/ImHex/build/install/imhex.app/Contents/Frameworks'
--   ignoreItems=''
-- fixup_bundle: preparing...
--
warning: cannot resolve item '@rpath/libc++abi.1.dylib'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

-- warning: gp_resolved_file_type non-absolute file '@rpath/libc++abi.1.dylib' returning type 'other' -- possibly incorrect
--
warning: cannot resolve item '@rpath/libc++abi.1.dylib'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

--
warning: cannot resolve item '@rpath/libunwind.1.dylib'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

-- warning: gp_resolved_file_type non-absolute file '@rpath/libunwind.1.dylib' returning type 'other' -- possibly incorrect
--
warning: cannot resolve item '@rpath/libunwind.1.dylib'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

--
warning: cannot resolve item '@rpath/libc++abi.1.dylib'

  possible problems:
    need more directories?
    need to use InstallRequiredSystemLibraries?
    run in install tree instead of build tree?

CMake Error at /usr/local/Cellar/cmake/3.30.3/share/cmake/Modules/BundleUtilities.cmake:458 (message):
  otool -l failed: 1

  error: /Library/Developer/CommandLineTools/usr/bin/otool-classic: can't
  open file: @rpath/libc++abi.1.dylib (No such file or directory)

Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.30.3/share/cmake/Modules/BundleUtilities.cmake:527 (get_item_rpaths)
  /usr/local/Cellar/cmake/3.30.3/share/cmake/Modules/BundleUtilities.cmake:614 (set_bundle_key_values)
  /usr/local/Cellar/cmake/3.30.3/share/cmake/Modules/BundleUtilities.cmake:933 (get_bundle_keys)
  /Users/rinkjames/Documents/projects/ImHex/cmake/modules/PostprocessBundle.cmake:57 (fixup_bundle)
  cmake_install.cmake:363 (include)

FAILED: CMakeFiles/install.util
cd /Users/rinkjames/Documents/projects/ImHex/build && /usr/local/Cellar/cmake/3.30.3/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed.
WerWolv commented 2 months ago

You don't need to build a bundle. Remove the -DIMHEX_GENERATE_PACKAGE=ON flag from the cmake command

rinkjames commented 2 months ago

You don't need to build a bundle. Remove the -DIMHEX_GENERATE_PACKAGE=ON flag from the cmake command

Thank you. Compilation completed without errors after this change. The executable imhex file opens terminal and runs the app. The app file throws an error.

From a very quick look at the compiled app, the blurry behaviour appears to be gone on my machine now.

Screenshot 2024-09-09 at 07 31 46 Screenshot 2024-09-09 at 07 33 33
python273 commented 5 days ago

Adding this to /Applications/ImHex.app/Contents/Info.plist seem to fix the issue

<key>NSHighResolutionCapable</key>
<true/>