Bug 159275 - [PATCH] Konsole's KPart does not properly set its focus proxy
Summary: [PATCH] Konsole's KPart does not properly set its focus proxy
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 2.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-14 01:19 UTC by David Benjamin
Modified: 2008-03-14 03:06 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Delays the focus proxy setting (556 bytes, patch)
2008-03-14 01:25 UTC, David Benjamin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Benjamin 2008-03-14 01:19:15 UTC
Version:           2.1 (using Devel)
Installed from:    Compiled sources
OS:                Linux

Steps to Reproduce:
1. Open Dolphin.
2. Press F4.

Result: Terminal part does not gain focus. Pressing tab focuses it.

Looking at Part.cpp, it sets a focus proxy, but _viewManager->activeView() is NULL at this point, so the call does nothing.
Comment 1 David Benjamin 2008-03-14 01:25:35 UTC
Created attachment 23890 [details]
Delays the focus proxy setting

This patch fixes the problem... I think.

I suspect this is not the correct way to solve the problem, and I'm not
familiar enough with the code to know how it all fits together. But... it seems
that this call should be in the view manager or something like that. Would one
ever _not_ want this focus proxy to be set? i.e. is there any point to having
focus on the view manager (or view controller or whatever)

I'm guessing the rationale is because the part is single-session, whereas
Konsole itself can be tabbed and such, but is there a reason even then not to
have a focus proxy? (I don't know exactly the jobs of all the parts or what
focus will do in each case.) Also, there seems to be a Part::newTab() method,
so can the KPart mimic Konsole entirely?

Sorry if the above is horribly inaccurate and just random. :-) Again, I'm not
familiar with the code.
Comment 2 Robert Knight 2008-03-14 02:50:26 UTC
SVN commit 785436 by knight:


Backport startup focus fix for embedded terminal.

BUG: 159275



 M  +2 -1      Part.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=785436
Comment 3 Robert Knight 2008-03-14 03:06:37 UTC
>  _viewManager->activeView() is NULL at this point, so the call does nothing.

Well spotted, thank-you.  I fixed this by using the view associated with the controller passed to Part::activeViewChanged() in the 4.0 branch and moved the focus proxy setting into ViewManager in the 4.1 branch (SVN commit r785440)

> is there any point to having focus on the view manager

The view manager itself is not a widget, but it does have a 'main' widget (a splitter used to divide multiple views within a window).  This splitter widget's focus proxy should be set to the visible terminal display which wasn't happening. 

> Also, there seems to be a Part::newTab() method,
> so can the KPart mimic Konsole entirely? 

With some work, yes.  Only the small amount of code in the Application and MainWindow classes are unique to the Konsole application and only the Part class is unique to the embedded terminal.  Everything else is shared between the two.  Tabs are just turned off in the part via the setNavigationMethod() call when the part is created because I have not sorted out how integration with other applications such as Kate and KDevelop which provide their own tabbed views is going to work.