Hey there,
I see there is a borderless window which makes an app look really nice, but then moving it around seems to be a bit difficult. Is there any sort of way built in to have an area at the top in which is still dragable that I might be missing, or is that going to have to be custom within glfw?
Thanks,
-MH
As always.. You just have to build a plugin!
I took this real-world problem and made a GLFW example plugin. You can find the example under the name draggable_borderless
This is fantastic, thank you very much! I do want to report that I have implemented it and while it does work, strangely, whenever I grab to drag it, that particular window drops to about 1 fps. Not just the output of the display of the window, but moving the window around my actual screen space.
You can see what I mean here https://i.imgur.com/cAKz1EG.gifv
From the time I opened it and first move my mouse to the top I am clicking and holding the whole time until the end. It seems that if I move it any sort of decent amount at once it will sit there and wait until I slow down then it pops to place. If I moved it slowly it sort of inches its way along.
I don't see any error messages while running the application with just hover run. I am assuming that the performance would be influenced by the complexity of my application? The application isn't really that complex yet. Perhaps I need to figure out how to somehow performance profile my application to see if that is the cause. I am still just learning, so it could very well be from misoptimization in my hierarchy.
Regardless of my personal issues, I thank you again for this. It definitely upped the "niceness" of my application. : D
I am assuming that the performance would be influenced by the complexity of my application?
If you are making sync platform calls, the app will stop rendering frames until the platform calls is completed.
I tried on my own with a more complicated app, I don't really have a solution for your app's sluggishness.
Hmm... well, technically it shouldn't be making lots of them. I just make one at the start of the app to get data to populate the list of cards on the main screen. That doesn't necessarily mean that it isn't doing more than I think it's doing. I had a pretty strong feeling that the cause was of my own doing. I attempted to introduce the Provider package into my app last night, so there is a good chance I goofed something up along the way. I will have to put a few log messages in there and see if I get repeating calls.
Thanks!
are you using HandleFuncSync or HandleFunc?
If you are using HandleFuncSync I strongly recommend you to switch to HandleFunc.
I am using this below, I believe it was just what I found in the demo plugin.
func (d *DataPlugin) InitPlugin(messenger plugin.BinaryMessenger) error {
channel.HandleFunc(getRemotes, d.getRemotesFunc)
}
Your app's sluggishness doesn't comes form the platform messages.
The issue might come from the the AppBarDraggable plugin while loop, but I don't know how to solve the your particular issue.
Does the raw https://github.com/go-flutter-desktop/examples/tree/master/draggable_borderless example works for you? (no sluggishness)
Actually, I just tried it out, it does the same thing.
Here are my specs.
///////////// mosthated@mosthated-pc
///////////////////// ----------------------
///////*767//////////////// OS: Pop!_OS 19.04 x86_64
//////7676767676*////////////// Host: MS-7B79 2.0
/////76767//7676767////////////// Kernel: 5.0.0-21-generic
/////767676///*76767/////////////// Uptime: 2 days, 9 hours, 45 mins
///////767676///76767.///7676*/////// Packages: 3603 (dpkg), 13 (flatpak), 10 (snap)
/////////767676//76767///767676//////// Shell: zsh 5.5.1
//////////76767676767////76767///////// Resolution: 1080x1920, 2560x1080, 1920x1080
///////////76767676//////7676////////// DE: GNOME 3.32.1
////////////,7676,///////767/////////// WM: GNOME Shell
/////////////*7676///////76//////////// WM Theme: Pop
///////////////7676//////////////////// Theme: Pop-slim-dark [GTK2/3]
///////////////7676///767//////////// Icons: Adwaita [GTK2/3]
//////////////////////'//////////// Terminal: java
//////.7676767676767676767,////// CPU: AMD Ryzen 5 2600 (12) @ 3.400GHz
/////767676767676767676767///// GPU: NVIDIA GeForce RTX 2070
/////////////////////////// Memory: 16193MiB / 32175MiB
/////////////////////
/////////////
[鉁揮 Flutter (Channel beta, v1.7.8+hotfix.4, on Linux, locale en_US.UTF-8)
[鉁揮 Android toolchain - develop for Android devices (Android SDK version 29.0.1)
[鉁揮 Android Studio (version 3.4)
[鉁揮 IntelliJ IDEA Ultimate Edition (version 2019.2)
I have read: https://stackoverflow.com/questions/46203809/glfw-mouse-event-lag-with-window-drag/46205940#46205940
The author experiences the same issue:
Update: I have also tried moving the glfwSetWindowPos logic into the main loop as well with no success鈥擨 still get the same shaking and stuttering.
Sorry I cannot help you. :disappointed:
It's up to you to tweak the example to get less stuttering, GLFW how to drag undecorated window
I understand. I appreciate all you have done so far, it is no problem.
when I run the example, the error is that:
2019-09-05 15:01:19.598 draggable_borderless[81306:1479963] pid(81306)/euid(501) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
And the demo can not draggle any more.
my env: go 1.12.9,
flutter : Flutter (Channel beta, v1.9.1+hotfix.1, on Mac OS X 10.14.4 18E226, locale zh-Hans-CN)
@NetFly-VPN correct, the example abuse GLFW.
In the go example code, I call p.window.GetCursorPos() and p.window.SetPos from a different thread than the main one.
I'm thinking of a fix.
@NetFly-VPN the draggable_borderless example is now fixed.
I can not resize the window when setting borderless.Is that possible to remove the header(close widget etc) only?
@goldenduo have you figured out how to fix this?
Most helpful comment
As always.. You just have to build a plugin!
I took this real-world problem and made a GLFW example plugin. You can find the example under the name draggable_borderless