Author Topic: code completion does not get focus  (Read 30496 times)

pwuertz

  • Guest
code completion does not get focus
« on: October 18, 2005, 03:18:00 am »
hi there

its a little bit strange, but when requesting code completion, the code completion window does not get the focus, so I have to use the mouse to activate it.

i'm using the current cvs version. compiled with gtk 2.8.6, wxGTK 2.6.2

any ideas why this happens?

pwuertz

  • Guest
Re: code completion does not get focus
« Reply #1 on: October 29, 2005, 11:20:27 am »
this seems to be a window-manager issue...

the code completion window is working correctly using
gnome window-manager "metacity"
xfce window-manager "xfwm"

the code completion window does not get focus and closes when trying to move/resize
using kde's "kwin"

can anyone confirm that?

pwuertz

  • Guest
Re: code completion does not get focus
« Reply #2 on: October 31, 2005, 08:59:13 am »
yes? no? hello?
no kde users here?!

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: code completion does not get focus
« Reply #3 on: October 31, 2005, 04:25:31 pm »
Sorry, windows user here :(

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: code completion does not get focus
« Reply #4 on: October 31, 2005, 07:35:30 pm »
not yet, I am working on getting KDE to work ;)
So please hold on for a few days (I am not very fast :P)
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

pwuertz

  • Guest
Re: code completion does not get focus
« Reply #5 on: November 21, 2005, 12:07:05 pm »
*bump*

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: code completion does not get focus
« Reply #6 on: November 21, 2005, 12:56:36 pm »
I have got the same problems using enlightenment e16. The code-completion windows only gets the focus when the mouse is above it. In fact, that is the intended behavior for application windows (that means in order to switch between running applications I just move the mouse onto them), but this is definitely not good for code-completion. Is there a possibility to change this behavior from Code::Blocks or is changing the settings of the windowmanager or even the windowmanager itself the only solution to this problem?
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: code completion does not get focus
« Reply #7 on: November 21, 2005, 02:21:47 pm »
I have got the same problems using enlightenment e16. The code-completion windows only gets the focus when the mouse is above it. In fact, that is the intended behavior for application windows (that means in order to switch between running applications I just move the mouse onto them), but this is definitely not good for code-completion. Is there a possibility to change this behavior from Code::Blocks or is changing the settings of the windowmanager or even the windowmanager itself the only solution to this problem?

All we 're doing is display a window. What the window manager does with it, we don't know and there's not much we can do about it.
The only special thing about this window is that if you click outside it, it disappears...
Be patient!
This bug will be fixed soon...

takeshimiya

  • Guest
Re: code completion does not get focus
« Reply #8 on: November 21, 2005, 05:30:47 pm »
It would be good if you can make think other programs that its a combobox or another control but NOT a window.

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: code completion does not get focus
« Reply #9 on: November 21, 2005, 05:48:35 pm »
It would be good if you can make think other programs that its a combobox or another control but NOT a window.

Yeah, any chance of making it just another control that happens to be on top of the editor?

pwuertz

  • Guest
Re: code completion does not get focus
« Reply #10 on: November 21, 2005, 08:43:22 pm »
I don't know anything about WxWidgets, but in some other environments it would be sufficient to invoke some kind of "window->setFocus()" method. I haven't found such a method in the Wx documentation, but as i said i don't have any experience with that toolkit.

Does Wx allow some kind of floating combobox as described by Takeshi Miya or Urxae?

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: code completion does not get focus
« Reply #11 on: November 21, 2005, 08:47:25 pm »
virtual void wxWindow::SetFocus()

This sets the window to receive keyboard input.

That one could do the trick...

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: code completion does not get focus
« Reply #12 on: November 21, 2005, 08:56:44 pm »
I'm not sure if I did it right but I have already tested this and at least on enlightenment e16 it didn't work (which seems quite logical). Maybe this is different on other window-managers but it seems that this is not overall solution.
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

takeshimiya

  • Guest
Re: code completion does not get focus
« Reply #13 on: November 21, 2005, 09:02:37 pm »
The codecompletion should be a control, not a window.

Some window managers implements focus over the cursor.

sfeng

  • Guest
Re: code completion does not get focus
« Reply #14 on: November 22, 2005, 04:35:56 am »
my codecompletion can't work,too

Offline Jorg

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: code completion does not get focus
« Reply #15 on: November 22, 2005, 09:05:24 am »
I have been pointed to this thread from my original one. This is my config:

KDE3.4 (I think)
Suse 10
CodeBlocks from SUSE10, CVS build rpm

Just to think along (as I am a wxWidgets developer too) what window do you use ? Is it a normal window? I assume you are using wxSTC or wxScintilla for your source display, right ? Maybe it helps if that has a method to display the code completion list. Also making the window show modal (if that is desired I do not know) might solve your problem as it will not switch focus to the disabled parent.

- Jorgen



Offline Jorg

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: code completion does not get focus
« Reply #16 on: November 23, 2005, 08:52:25 am »
Ok I think I found a way around it. Sorry to dissapoint all KDE guys, but Gnome seems to behave MUCH better with Code::Blocks in many ways.. The search dialog for example also did not show the focus on the text ctrl which is also nice if one would like to quickly find something. In Gnome the focus is properly set to the code completion box, and the search box. Also the code completion box could be properly resized and moved without problems.

It is definately a window manager issue. I have abandoned KDE for now, as I am more into minimalism anyway, and Gnome works faster.

Besides this minor inconsistency between Windowmanagers (which I truely believe cannot be Code::Blocks fault) I am very-very pleased with this IDE. It works great in debugging, building and coding .. :-) Keep up the good work guys!

- Jorgen

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: code completion does not get focus
« Reply #17 on: November 25, 2005, 06:05:45 pm »
Good news: It seems as I have found a solution for this problem - it at least works on enlightenment e16 now.
The only necessary change is adding the flag wxFRAME_FLOAT_ON_PARENT to the style list the constructor of CCList passes to the constructor of its base class 'wxFrame'. This takes place on line 65 of the file 'src/plugins/codecompletion/cclist.cpp'. (I used the version which was available from cvs today).
Maybe some other guys could test this with other window managers and report if it works there, too.
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline Jorg

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: code completion does not get focus
« Reply #18 on: November 26, 2005, 02:40:29 pm »
It would be great if I could get a RPM or a precompiled binary to try ;-) I think building C::B from CVS is a bit too much for me..
I am now using C:: with Gnome, but it seems KDE works better under Suse (I bet that is why they made it default) and I am also experiencing some weird GUI hangups and error sometimes (not C::B related).

Thanks in advance,
- Jorgen

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: code completion does not get focus
« Reply #19 on: November 30, 2005, 01:06:11 pm »
*push*
Did anyone test my solution yet? Would be nice to know if this works one more than just one window manager...
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline Jorg

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: code completion does not get focus
« Reply #20 on: November 30, 2005, 01:10:28 pm »
I would like to but i cannot compile C::B from CVS, I get weird errors with wx2.6.2 like wxWindow::SetTitle() undefined, which is correct, because a grep on it did not show any hints. What wx version is C::B using anyway?

I also got weird linker errors, so I could not continue trying to build it. I tried configuring C::B with disable-shared to make a static build but to no avail.

- Jorgen

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: code completion does not get focus
« Reply #21 on: November 30, 2005, 01:37:59 pm »
Which compiler did you use? I got lots of errors, too, when I tried to compile Code::Blocks with gcc 3.3.6. With gcc 3.4.4 (and wxGTK-2.6.1) I was able to compile the svn-version from the last weekend without any problems using the following commands:
Code
./bootstrap
./configure --enable-contrib --with-wx-config=wx-config-2.6
make
make install
(The last one of course requires root-privileges.)
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline lesnewell

  • Multiple posting newcomer
  • *
  • Posts: 66
Re: code completion does not get focus
« Reply #22 on: December 01, 2005, 02:20:58 pm »
Your build problems are probably due to a bug in the makefile. Look here http://forums.codeblocks.org/index.php?topic=1429.msg10768#msg10768 for an explanation how I got around it. The bug is a sneaky one because if you have successfully built a recent version of C::B it won't show up, otherwise you get all sorts of wierd link errors.

Anyway, back on topic. I just tried the latest CVS head.
GNOME:
Works perfectly

IceWM
Works OK but window disappears as soon as you try to resize it

KDE
Window does not get the focus but at least it does not disappear when you click on it now.
Window disappears if you try to resize it

WindowMaker
Window gets the focus but if you move the mouse over it then off of it the window disappears (focus follows mouse?)
Window disappears if you try to resize it

All of these are on Mandriva 2006
« Last Edit: December 01, 2005, 02:23:48 pm by lesnewell »

Offline Der Meister

  • Regular
  • ***
  • Posts: 307
Re: code completion does not get focus
« Reply #23 on: December 01, 2005, 03:51:42 pm »
Did you test with my solution or just the source which is currently in the svn repository? If it was just the source code from svn then could you please repeat your test on KDE with the modification I described in this post? Because this fixes the focus-problem on enlightenment e16 and it would be nice to know if it works on KDE, too.
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand.
Real Programmers don't write in BASIC. Actually, no programmers write in BASIC, after the age of 12.

Offline lesnewell

  • Multiple posting newcomer
  • *
  • Posts: 66
Re: code completion does not get focus
« Reply #24 on: December 01, 2005, 10:22:06 pm »
Sorry, I thought it had been committed. OK, tried it and it make no difference on KDE. Can't currently try the other window managers. Hmm, GNOME is looking like a good idea ;-)