martinrotter / textosaurus

Cross-platform text editor based on Qt and Scintilla.
GNU General Public License v3.0
284 stars 44 forks source link

Stay On Top #31

Closed smaragdus closed 6 years ago

smaragdus commented 6 years ago

@martinrotter

You may add new command - Stay On Top (or just On Top) in View menu (with shortcut key, CTRL+T is very common) which puts Textosaurus on top of all windows. This would be very useful especially when the user needs to drag snippets of text (from web browser, mail client, other text editor, etc) into Textosaurus. To use such functionality currently I need to resort to external tools (for example SmartSystemMenu). Of course native support for Stay On Top would be better and handier. I suppose this feature would not be hard to be implemented.

martinrotter commented 6 years ago

Added to "View" menu, with bindable keyboard shortcut which defaults to Ctrl + T. Setting is persistent.

smaragdus commented 6 years ago

@martinrotter Thanks.

smaragdus commented 6 years ago

Problem- if I check Stay On Top when Textosaurus (version 0.9.0.0) is in maximized state and then I click Restore button in the title bar Textosaurus loses its minimized window state.

martinrotter commented 6 years ago

minimized window state

You mean non-maximized window state, right?

martinrotter commented 6 years ago

I did some tweaks, please test https://github.com/martinrotter/textosaurus/commit/744fa38c1049116db0d7227610eb36fb8baf46b6 when its development build gets compiled.

smaragdus commented 6 years ago

@martinrotter Yes. In fact it is meaningless to enable Stay On Top when Textosaurus is in maximized window state yet I did it and thus I discovered that it lost it previous non-maximized window state.

martinrotter commented 6 years ago

Yes, problem here is, that once I switch stay-on-top flag, then Qt (GUI library) automatically hides the window and DISCARDS its internal state (size/position). This is because of some low-level OS restrictions for top-level windows. So, I tried to add necessary logic by myself in latest commit. Test it pls, if you can.

smaragdus commented 6 years ago

I did some tweaks, please test 744fa38 when its development build gets compiled.

OK, I will.

smaragdus commented 6 years ago

What about Stay On Top disabled when Textosaurus is in maximized state? I can't imagine any use for Stay On Top when program is in maximized state.

martinrotter commented 6 years ago

Well, if Textosaurus main window is maximized that does not mean that you cannot mave any windows in front of it. If someone wants to drag some texts into textosaurus main window, it does not matter that window is maximized or not. I would rather fix the behavior, which was indeed broken. Test, and we will see.

smaragdus commented 6 years ago

Version textosaurus-0.9.1-43d5130-win64 seems to resolve the problem with losing window state if Stay On Top was enabled in maximized window state. However switching to Stay On Top is not very smooth- the window flickers a bit.

martinrotter commented 6 years ago

Stay On Top is not very smooth- the window flickers a bit.

Yes, this is inevitable consequence of Qt implementation of "stay-on-top" flag. Nothing much better can be done. I could think about this.

smaragdus commented 6 years ago

Yes, this is inevitable consequence of Qt implementation of "stay-on-top" flag. Nothing much better can be done. I could think about this.

This is not a great problem.

You may release new fixed stable textosaurus version because this issue and the tray one (#13 ) were rather unpleasant.

martinrotter commented 6 years ago

Yes, I will release today.