Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the release of a click on the tab-title should put the content of the tab in the focus #15

Open
ralf3u opened this issue Nov 15, 2021 · 33 comments

Comments

@ralf3u
Copy link

ralf3u commented Nov 15, 2021

actual behavior
If I click on a tab-title of the sidebar: The tab-title is in focus, even if the mouse-key is not pressed any more. Evidence: There is no sign for it, but both tests below are negative.

control tests with a very long html-document, and with at least two tabs in the sidebar:
TEST 1: Open Geany, click on the Preview-tab-title, then press the arrow-left-key only once: the content of the Preview-tab should still be in focus.
TEST 2: Open Geany, click on the Preview-tab-title, then press the arrow-down-key only once: the html-document should move downwards.

expectation

  • The tab-title of Preview should be in focus as long as the mouse-key is pressed, but in the moment where the mouse-key is not pressed any more, the content of the Preview-tab should be in focus.
  • It should work for all tabs of the sidebar.

remark
The tabs in the sidebar should work exactly like the tabs in the editor: Open Geany, click on a tab-title of the editor and hold the mouse-key for about 10 seconds: tab-title is in focus, but in the moment where the mouse-key is not pressed any more, the content of the tab is in focus, and not the tab-title of the editor, what is visible with the highlighted line.

@ralf3u
Copy link
Author

ralf3u commented Feb 23, 2022

Maybe the solution of this issue has a connection with #5.

@ralf3u
Copy link
Author

ralf3u commented Mar 17, 2023

The main problem of #5 is the detection of a signal whether sidebar is in focus or not in focus when clicking in the sidebar. This signal apparently does not exist in Geany.

But the problem of #15 is different: When clicking on the tab-title of the sidebar, the tab-title of the sidebar becomes green. I don't know how to program software, but does not something exist like:

IF there is a CSS-color change of the tab-title, THEN execute something like geany.keycmd("FOCUS_SIDEBAR").

(For more information to geany.keycmd("FOCUS_SIDEBAR"), see xiota/geanylua-scripts#7 (comment)).

@ralf3u
Copy link
Author

ralf3u commented Mar 18, 2023

I don't know how to program software, but does not something exist like:
IF there is a CSS-color change of the tab-title, THEN execute something like geany.keycmd("FOCUS_SIDEBAR").

Is this possible or not possible?

@xiota
Copy link
Owner

xiota commented May 11, 2023

Setting focus has been an ongoing issue that may not be resolvable any time soon.

@ralf3u
Copy link
Author

ralf3u commented May 14, 2023

In September 2022 I opened at Geany the issue number 3289. In that issue there are two links about GTK3 that could help to solve the focus issue:

https://docs.gtk.org/gtk3/signal.Notebook.focus-tab.html
https://docs.gtk.org/gtk3/signal.Widget.grab-focus.html

Did you try both?

@xiota
Copy link
Owner

xiota commented May 15, 2023

I tried every signal a couple years ago. None of them worked at the time. The problem is focus goes where you don't want it. You want the browser contents to be in focus. But usually some other part of the notebook is given focus, like the tabbar. Even when I think focus has gone where you want it, when you start navigating with the keyboard, focus can be moved to a different component. (Then you open an issue saying press some keys in some order and the tab changes instead of scrolling the view.)

@ralf3u
Copy link
Author

ralf3u commented May 19, 2023

OK, but what about the idea to report at GTK that some things don't work as they should?

I think that there are two issues that should be reported at GTK because they don't work correctly:

  • to detect if content-area of the tab has focus,
  • to put the focus on the content-area of the tab.

I will not report the issues because I have too less knowledge about programing software.

@xiota
Copy link
Owner

xiota commented May 19, 2023

I will not report the issues because I have too less knowledge about programing software.

I don't know enough to be sure there is a problem with GTK or whether it's working the way they want it to. They may not want programmers to be able to move focus around in certain circumstances because it's a potential security risk (eg, to intercept user input).

@ralf3u
Copy link
Author

ralf3u commented May 19, 2023

I don't know enough to be sure there is a problem with GTK or whether it's working the way they want it to.

I would say: Just report it and then you will know with the answer they offer.

@xiota
Copy link
Owner

xiota commented May 19, 2023

Just report it and then you will know with the answer they offer.

I don't really want to write code to reproducibly replicate the problem, try fixes, etc. Plus, GTK development has moved on to GTK4. I don't even know if Geany and plugins build with GTK4.

@ralf3u
Copy link
Author

ralf3u commented May 19, 2023

I don't even know if Geany and plugins build with GTK4.

Maybe this information helps: #5 (comment).

@xiota
Copy link
Owner

xiota commented May 20, 2023

I doubt the devs will proactively update that issue. When they do decide to support GTK4, the devs (not users) will probably have to open a lot of new issues to remove outdated GTK3 stuff.

@ralf3u
Copy link
Author

ralf3u commented May 20, 2023

So, that means for me that you wait till Geany und the plugins will support GTK4, and then, if the issue is still there, you would report it to GTK. The problem could be then that GTK5 will be already available. So, it could be that the issue will never be reported.

When they do decide to support GTK4, the devs (not users) will probably have to open a lot of new issues to remove outdated GTK3 stuff.

That's your point of view. I have another point of view: If you report the issues now, then I can imagine that they will not fix it for GTK3 but maybe think about a solution that will be supported only by GTK4 and future versions.

@xiota
Copy link
Owner

xiota commented May 20, 2023

I am not going to open bug reports to GTK about this. The entire process will take a lot of time and effort. Most likely nothing would come of it.

Why don't you figure out how to access and search their bug reports to see whether it's already been reported. Then you can track it's process. https://gitlab.gnome.org/GNOME/gtk/-/issues/

@ralf3u
Copy link
Author

ralf3u commented May 20, 2023

Well, I can try to report at GTK. Let's try first with the title. I would describe it like this:
issue 1:
GTK3: no possibility to put focus on the content-area of a tab of the sidebar in the editor Geany
issue 2:
GTK3: no possibility to detect if content-area of a tab of the sidebar is in focus in the editor Geany

Is it OK like this?

@xiota
Copy link
Owner

xiota commented May 20, 2023

Do a search first to see if you find anything relevant. I don't really want to be involved in an upstream bug report.

@ralf3u
Copy link
Author

ralf3u commented May 20, 2023

OK

@ralf3u
Copy link
Author

ralf3u commented Mar 21, 2024

I just recognized that in Lubuntu 23.10 with Geany 1.38 if I click in the sidebar on the tab-title Files (plugin File Browser), then the content of the tab is also not in focus. I will report it the next days at geany-plugins.

@ralf3u
Copy link
Author

ralf3u commented Mar 21, 2024

Before reporting the issue at geany-plugins, I wanted to ask if the information could help to solve the issue:
https://docs.gtk.org/gtk3/method.Widget.child_focus.html

@xiota
Copy link
Owner

xiota commented Mar 24, 2024

I don't see how this is related to geany-plugins.

@ralf3u
Copy link
Author

ralf3u commented Mar 24, 2024

I just opened at geany-plugins an issue with the issue number 1320. The title of the issue is:
"A release of a click on the tab-title of a plugin-tab in the sidebar should put the content of the tab in focus".

@ralf3u
Copy link
Author

ralf3u commented Mar 25, 2024

The plugin Preview is not responsible for this issue. The issue has to be fixed upstream. That is the reason why I close this issue.

@ralf3u ralf3u closed this as completed Mar 25, 2024
@ralf3u
Copy link
Author

ralf3u commented Mar 25, 2024

Could you please join the conversation at geany-plugins 1320, because the maintainer claims that the issue does not belong to the Geany project.

@ralf3u
Copy link
Author

ralf3u commented Mar 25, 2024

Now the maintainer added some more information:

Therefore plugins are entirely responsible for the behaviour of their UI. Plugins should connect to the relevant signal eg "switch-page" or "focus-tab" or "clicked" on the tab or whatever and then implement the behaviour they require.

So, the sentences for me mean that Preview is the problem. The sentences mean also for me that the issue can be solved in the plugin Preview.

[...] I said elsewhere the tab and the contents are different things, and in standard GTK the tab can be focussed instead of the content by clicking it when the page is current.

When I observed the behavior of the plugin File Browser, I thought that it was the same for the plugin Preview, namely that the toolbar is in focus. But now I think that it is not the toolbar that is in focus after a release of a click on the Preview-tab, it is the tab, and that is the reason why I have first to press 1x the arrow-down-key on the keyboard to put the content of the tab in focus.

@xiota
Copy link
Owner

xiota commented Mar 25, 2024

When the tab is clicked, the tab itself is in focus. Probably not a good idea to change focus to the contents because that would interfere with changing tabs with left/right. You would then have to use ctrl+pgdn / ctrl+pgup.

Figuring out the exact component of interest and the right signals to use is difficult and unreliable. Focus may not go where you want or expect with every sidebar plugin. I already tried unsuccessfully to change focus to the gtkwebkit widget in the past.

@ralf3u
Copy link
Author

ralf3u commented Mar 25, 2024

When the tab is clicked, the tab itself is in focus. Probably not a good idea to change focus to the contents because that would interfere with changing tabs with left/right.

I don't know what you mean.

You would then have to use ctrl+pgdn / ctrl+pgup.

I use ctrl+pgdn / ctrl+pgup now anyway for tab-browsing in the sidebar. It works when I click on the tab-title of the Preview-tab and it works also when the content of the Preview-tab is in focus.

@xiota
Copy link
Owner

xiota commented Mar 26, 2024

Since xitweaks has tab switching detection basically working, I'll take a look at whether the contents can be focused. However, I'm expecting it will not work for the gtkwebkit widget (used by preview plugin), since it didn't work in the past.

@ralf3u
Copy link
Author

ralf3u commented Mar 26, 2024

[...], I'll take a look at whether the contents can be focused.

This would be great, because it is the last existing important artifact in the plugin Preview.

@xiota
Copy link
Owner

xiota commented Mar 27, 2024

The xitweaks plugin already has code that moves focus to the contents of the notebooks when sidebar_focus or notebook_focus features are enabled. It is working on my computer. Please check whether it is working on yours.

I also found a few minor bugs. Will try to fix them.

@ralf3u
Copy link
Author

ralf3u commented Mar 27, 2024

Please check whether it is working on yours.

This issue still exists on my computer after sudo apt update and sudo apt dist-ugrade. If I click on the tab-title on the Preview-tab, the content of the tab is not in focus because I have to press 2x the arrow-down-key of the keyboard, so that a very long webpage starts to scroll downwards.

It is working on my computer.

Maybe this issue is fixed in Geany 2.0. I use Lubuntu 23.10 and Geany 1.38.

@xiota
Copy link
Owner

xiota commented Mar 27, 2024

Could also be something in gtk3 library. I remember the signals didn't work a few years ago when you opened these issues.

@ralf3u
Copy link
Author

ralf3u commented Mar 27, 2024

So, let's wait till Lubuntu 24.04.

But it is good to know that it is working on your computer!

@ralf3u
Copy link
Author

ralf3u commented Apr 21, 2024

In #15 (comment) you write:

The xitweaks plugin already has code that moves focus to the contents of the notebooks when sidebar_focus or notebook_focus features are enabled. It is working on my computer. Please check whether it is working on yours.

In Geany in Lubuntu 23.10 the issue is still not fixed. If I click on the Preview-tab-title, the content of the tab is still not in focus.

@ralf3u ralf3u reopened this Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants