ubuntu / handy_window.dart

Provides modern-looking Handy windows with rounded bottom corners for Flutter applications on Linux
https://pub.dev/packages/handy_window
Mozilla Public License 2.0
26 stars 7 forks source link

Window flickering when using trackpad gestures. #12

Open whiskeyPeak opened 1 year ago

whiskeyPeak commented 1 year ago

I'm experiencing a lot of window flickering mainly whenever there is a lot of scrolling in the app, although it also happens when doing other normal operations. The window titlebar also doesn't render the close/expand/minimise buttons.

This is happening on Linux Mint Debian Edition 5 Cinnamon, on a Dell XPS 15 9500. I'm using the nouveau drivers for my Nvidia graphics card.

https://user-images.githubusercontent.com/73116038/204143185-d1d35cf7-6a73-4b88-99bf-ad4ef080b87b.mp4

flutter doctor:

[✓] Flutter (Channel stable, 3.3.9, on LMDE 5 (elsie) 5.10.0-19-amd64, locale
    en_GB.UTF-8)
    • Flutter version 3.3.9 on channel stable at
      /home/henryr/Dev/SDK/Flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision b8f7f1f986 (5 days ago), 2022-11-23 06:43:51 +0900
    • Engine revision 8f2221fbef
    • Dart version 2.18.5
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /home/henryr/Android/Sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • Java binary at: /home/henryr/Dev/SDK/AndroidStudio/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Debian clang version 11.0.1-2
    • cmake version 3.18.4
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[✓] Android Studio (version 2021.2)
    • Android Studio at /home/henryr/Dev/SDK/AndroidStudio/android-studio
    • Flutter plugin version 71.0.2
    • Dart plugin version 212.5744
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • LMDE 5 (elsie) 5.10.0-19-amd64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 107.0.5304.110

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Reproduceable code:

import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
        debugShowCheckedModeBanner: false, home: ListViewBuilder());
  }
}

class ListViewBuilder extends StatelessWidget {
  const ListViewBuilder({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text("Flickering bug")),
      body: ListView.builder(
          itemCount: 100,
          itemBuilder: (BuildContext context, int index) {
            return ListTile(
                leading: const Icon(Icons.list),
                trailing: const Text(
                  "GFG",
                  style: TextStyle(color: Colors.green, fontSize: 15),
                ),
                title: Text("List item $index"));
          }),
    );
  }
}

cc @Feichtmeier

Feichtmeier commented 1 year ago

The interesting part should be my_application.cc and whether this does not happen without habdy_window

The noveau driver also caused a lot of issues from my expenses in general. Did you try a different driver?

jpnurmi commented 1 year ago

Could you try installing handy-1-examples and try if the rendering issues are reproducible when running /usr/bin/handy-1-demo, please?

EDIT: Oops, nevermind, you said Mint. packages.linuxmint.com gives 0 results for "handy" :eyes:

whiskeyPeak commented 1 year ago

Could you try installing handy-1-examples and try if the rendering issues are reproducible when running /usr/bin/handy-1-demo, please?

That package is actually in the Debian repo as well! I ran it and saw no flickering at all. Debian Bullseye (what Linux Mint DE 5 is based on) uses a really old version of libhandy (1.0.3-2). The testing repo uses libhandy 1.8.0-1. I'll see if upgrading that package fixes anything.

The noveau driver also caused a lot of issues from my expenses in general. Did you try a different driver?

I blacklisted the Nvidia GPU from my system and the issue is still occurring

The interesting part should be my_application.cc and whether this does not happen without habdy_window

Yeah, the default GTK window works completely fine, it's only when I switch to the handy window that I start seeing the flickering.

jpnurmi commented 1 year ago

Glad to hear that the basic handy demo works. A more interesting test case would be HdyWindow + GtkGLArea because it'd be closer to the structure of a Flutter application with this package enabled. I'm not sure if there's any ready-made test case for that, though.

whiskeyPeak commented 1 year ago

Upgraded the libhandy package and I still get the flickering.

Feichtmeier commented 1 year ago

@whiskeyPeak

I didn't get this part

I blacklisted the Nvidia GPU from my system and the issue is still occurring

I would be interested in seeing if this flickering with libhandy and flutter also happens if you change your driver to the official nvidia driver - sorry if you said this and I just did not understand it

whiskeyPeak commented 1 year ago

I would be interested in seeing if this flickering with libhandy and flutter also happens if you change your driver to the official nvidia driver - sorry if you said this and I just did not understand it

The issue still occurs on the Nvidia Nouveau driver, the proprietary Nvidia driver and the Intel integrated GPU.

Something interesting is that the flickering goes away if the window is maximised, or tiled on the sides/corner.

Feichtmeier commented 1 year ago

I would be interested in seeing if this flickering with libhandy and flutter also happens if you change your driver to the official nvidia driver - sorry if you said this and I just did not understand it

The issue is occurs on the Nvidia Nouveau driver, the proprietary Nvidia driver and the Intel integrated GPU.

Something interesting is that the flickering goes away if the window is maximised, or tiled on the sides/corner.

WHat happens if you remove the gtk header bar entirely in my_application.cc ?

whiskeyPeak commented 1 year ago

WHat happens if you remove the gtk header bar entirely in my_application.cc ?

Issue still persists unfortunately

whiskeyPeak commented 1 year ago

Forcing it to use a GTK header bar also doesn't fix the issue, although it does give me close, maximize, minimize buttons.

jpnurmi commented 1 year ago

How does the app behave if you set GTK_CSD=0 environment variable?

whiskeyPeak commented 1 year ago

I get the same handy window with the same issues

whiskeyPeak commented 1 year ago

I tested a base flutter handy window with a scrollview on Fedora(Gnome/Cinnamon), Linux Mint(Cinnamon) and Ubuntu(Gnome/Cinnamon) and in each case, the flickering occurred on the Cinnamon version of the distro. The Gnome version was completely ok and even seemed to run faster.

Edit: I just tested this on Linux Mint 20 Cinnamon (about 2 and half years old now) and the window isn't flickering. This is definitely a regression though it's going to be hard to pinpoint exactly where it is coming from.