Bug 45312 - kwin eats Ctrl-B
Summary: kwin eats Ctrl-B
Status: RESOLVED FIXED
Alias: None
Product: kcontrol
Classification: Miscellaneous
Component: kcmkeys (show other bugs)
Version: unspecified
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: Ellis Whitehead
URL:
Keywords:
: 54046 54174 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-07-16 15:33 UTC by Devendra Deshpande
Modified: 2003-06-19 00:26 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch for Sun's F22/Print key (989 bytes, patch)
2003-04-09 01:41 UTC, Ellis Whitehead
Details
The right patch file this time... (993 bytes, patch)
2003-04-09 01:46 UTC, Ellis Whitehead
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Devendra Deshpande 2002-07-16 15:27:19 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           kwin
Version:           4.0 (KDE 3.0.6 (using KDE 3.0.6 )
Severity:          crash
Installed from:    compiled sources
Compiler:          gcc version 3.1
OS:                SunOS (sun4u) release 5.7
OS/Compiler notes: 

The short description says it all.

When I press ^B (Ctrl-B) a couple of times
kwin crashes. Since I use vi (and
emacs-mode in ksh also) I tend to use ^B
a lot.

It doesn't matter what app I am using. Pressing
^B in konsole/rxvt/konqueror/anywhere makes
kwin crash :-(

Here's the stacktrace --

[Switching to Thread 1 (LWP 1)]
0xfe39a02c in _waitid () from /usr/lib/libc.so.1
#0  0xfe39a02c in _waitid () from /usr/lib/libc.so.1
#1  0xfe358138 in _waitpid () from /usr/lib/libc.so.1
#2  0xfe2dafe0 in waitpid () from /usr/lib/libthread.so.1
#3  0xfe2d92d8 in __libthread_segvhdlr () from /usr/lib/libthread.so.1
#4  0xfe2dbd80 in __sighndlr () from /usr/lib/libthread.so.1
#5  <signal handler called>
#6  0xfe336f54 in strlen () from /usr/lib/libc.so.1
#7  0xfecfee5c in _XTextListToTextProperty () from /usr/openwin/lib/libX11.so.4
#8  0xfecff030 in _XmbTextListToTextProperty ()
   from /usr/openwin/lib/libX11.so.4
#9  0xfe5aa244 in _ZN10QClipboard5eventEP6QEvent ()
   from /usr/local/qt/lib/libqt-mt.so.3
#10 0xfe5faa4c in _ZN12QApplication14internalNotifyEP7QObjectP6QEvent ()
   from /usr/local/qt/lib/libqt-mt.so.3
#11 0xfe5fa348 in _ZN12QApplication6notifyEP7QObjectP6QEvent ()
   from /usr/local/qt/lib/libqt-mt.so.3
#12 0xfeee88a0 in _ZN12KApplication6notifyEP7QObjectP6QEvent ()
   from /usr/local/KDE/lib/libkdecore.so.4
#13 0xfe59f25c in _ZN12QApplication15x11ProcessEventEP7_XEvent ()
   from /usr/local/qt/lib/libqt-mt.so.3
#14 0xfe59e568 in _ZN12QApplication16processNextEventEb ()
   from /usr/local/qt/lib/libqt-mt.so.3
#15 0xfe5fc350 in _ZN12QApplication10enter_loopEv ()
   from /usr/local/qt/lib/libqt-mt.so.3
#16 0xfe59df04 in _ZN12QApplication4execEv ()
   from /usr/local/qt/lib/libqt-mt.so.3
#17 0xff37920c in kdemain () from /usr/local/KDE/lib/kwin.so

What is going on here? Who is listening to
^B?

Thanks
Devendra


(Submitted via bugs.kde.org)
(Called from KBugReport dialog)
Comment 1 Stephan Kulow 2002-09-22 00:26:20 UTC
I would think your X is buggy. do you get any output from kwin? 
Comment 2 Lubos Lunak 2002-10-25 14:31:21 UTC
 Waiting for an answer. 
 
Comment 3 Devendra Deshpande 2002-11-18 12:11:06 UTC
Sorry about the non-response.    I thought this could be a Qt/X bug (like Stephen suggested before). So I built  the new 3.1RC3 (with qt-copy,/KDE 3.1 RC3 from cvs, and gcc-3.1 on  Solaris 7).  Now, kwin doesn't crash anymore. However, any ^B I press silently   disappears! The vi in xterm never gets to see them "^B"s!!    And no,  I do not see any output for kwin at all :-(  Thanks, Devendra  
Comment 4 Devendra Deshpande 2002-11-28 12:25:53 UTC
Hi, 
 
This is no longer a crash, just a minor irritation (that all ^B are eaten up). 
 
I did more investigation over the last few days, here is what is happening: 
 
kdecore (KAccel): Key: Ctrl+B => 'Desktop Screenshot' 
 
Where does 'Desktop Screenshot' get the Ctrl+B accelerator? (And why, of 
all the apps, is kwin taking a screenshot)? 
 
More stack traces using pstack during startup of the app resulted in this output: 
 
kdecore (KAccel): grabKey( key: 'Ctrl+B', bGrab: 1 ): keyCodeX: 6f keyModX: 4 
8228:
Comment 5 Lubos Lunak 2002-11-28 12:37:26 UTC
Simply go to the KControl shortcuts module and check what key is configured for the 'Desktop 
Screenshot'. If it's configured to use the default key, try if it works after you change it to 
something different. The default for the action is Alt+PrintScreen, which IIRC Sun keyboards 
don't have, so maybe it gets the keyboard combination wrong. 
 
Comment 6 Devendra Deshpande 2002-11-28 13:22:15 UTC
Subject: Re:  kwin crashes when ^B is pressed a couple of times

On 28 Nov 2002 11:37:27 -0000 Lubos Lunak <l.lunak@kde.org> wrote:
> 
> ------- Additional Comments From l.lunak@kde.org  2002-11-28 12:37
> ------- Simply go to the KControl shortcuts module and check what key
> is configured for the 'Desktop Screenshot'. If it's configured to use
> the default key, try if it works after you change it to something
> different. The default for the action is Alt+PrintScreen, which IIRC
> Sun keyboards don't have, so maybe it gets the keyboard combination
> wrong.

Wow!

I did see Ctrl+Print for Screenshot. But the Sun keybaord I have DOES
have a PrintScreen key, hence I never suspected foul play.

But you were right, I explicitly assigned Ctrl+PrintScreen (which BTW is
Ctrl+F22) and things work like a charm.

Is it Qt that does not understand the PrintScreen key? Should I report
this problem to Trolltech (this stuff worked  Qt < 3.1, it only broke
starting with Qt 3.1 Betas) ...

Thanks a lot!
Devendra

Comment 7 Ellis Whitehead 2002-12-01 13:29:21 UTC
There was a similar problem a couple months ago where X was returning keycodes for 
unassigned keys on some systems (!), but unfortunately I didn't think to report the bug to 
XFree at the time, and instead just wrote a work-around into kdelibs.  I'll try to track it 
down again... 
Comment 8 Aaron Williams 2002-12-04 02:20:54 UTC
I have also seen the same type of crash in _XmbTextListToTextProperty.  I have 
a fix which I made in qt-3.0.5 but it hasn't yet made it into qt 3.1 or 3.0.6.  
The fix is as follows: 
 
in file qt-x11-free-3.0.5/src/kernel/qclipboard_x11.cpp  
771c771,777 
<                       char *list[] = { data.data() }; 
--- 
>                         if (data.resize(data.size()+1)) 
>                             *data.end() = 0; 
>                         char *list[] = { data.data(), ""}; 
>                         if (0 == list) { 
>                             qDebug("qclipboard_x11.cpp: encoded text/plain 
data is NULL"); 
>                             break; 
>                         } 
 
I have seen this problem elsewhere in KDE with many random crashes.  The above 
fix solves the problem.  I believe the problem is specific to Solaris and does 
not affect XFree86.  The documentation on XmbTextListToTextProperty is 
somewhat ambiguous with how the list data should be formatted.  Note that the 
main fix is appending a second NULL character to the first string.  The second 
empty string is not really needed. 
 
Hopefully this will be fixed in qt 3.1.1. 
 
-Aaron 
Comment 9 Devendra Deshpande 2002-12-04 06:05:08 UTC
Subject: Re:  kwin crashes when ^B is pressed a couple of times

On 4 Dec 2002 01:20:57 -0000 aaronw@net.com wrote:
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>      
> http://bugs.kde.org/show_bug.cgi?id=45312     
> 
> 
> 
> 
> ------- Additional Comments From aaronw@net.com  2002-12-04 02:20
> ------- I have also seen the same type of crash in
> _XmbTextListToTextProperty.  I have a fix which I made in qt-3.0.5 but
> it hasn't yet made it into qt 3.1 or 3.0.6.  The fix is as follows: 
>  
> in file qt-x11-free-3.0.5/src/kernel/qclipboard_x11.cpp  

Well, I did this to fix the problem:

            if ( (list[0] != NULL)
                 && ( XmbTextListToTextProperty( dpy, list, 1, style,
                            &textprop ) == Success ) ) {                

Note that, the third argument already specifies how many elements are
going to be in the list. So, appending another element to data might not
be required.

Besides, what use is a property that has no text in it?

But what do I know :-)

Thanks,
Devendra

Comment 10 Stephan Binner 2003-02-06 12:03:34 UTC
*** Bug 54174 has been marked as a duplicate of this bug. ***
Comment 11 Stephan Binner 2003-02-06 12:04:10 UTC
*** Bug 54046 has been marked as a duplicate of this bug. ***
Comment 12 Aaron Williams 2003-02-06 23:30:28 UTC
I too found this problem running on a Sun running Solaris 7.  The workaround is
as stated above.  Change the keybindings for window and desktop screencapture to
use something other than the default.  For some reason Ctrl+Print maps to Ctrl+B.
Comment 13 Ellis Whitehead 2003-03-23 23:13:47 UTC
Could one of you with a Sun keyboard run 'xev' and tell me what symbol name you get 
for Sun's PrintScreen key?  I'll add a hack to make sure that if Print returns Ctrl+B, to 
return Sun's PrintScreen key. 
Comment 14 Aaron Williams 2003-03-24 22:22:00 UTC
Solaris does not appear to contain the 'xev' program.  On my Ultrasparc, though,
PrintScreen maps to F22.
Comment 15 Ellis Whitehead 2003-03-29 22:28:48 UTC
Is there a define that I can use to know if we're on solaris?  I've taken a look at the 
code, and it would require a very inconvenient work-around for what I think is an X 
problem if I have to determine the problem dynamically.  With a define the problem could 
be worked around with just 7 lines of simple code... 
Comment 16 Aaron Williams 2003-03-31 22:38:30 UTC
Subject: Re:  kwin eats Ctrl-B

In Solaris (at least on Sparc), sun is defined.

Using

#ifdef sun

#endif

works fine.

-Aaron

Comment 17 Ellis Whitehead 2003-04-09 01:41:42 UTC
Created attachment 1327 [details]
Patch for Sun's F22/Print key

Please try this out.  It's a patch to kdelibs/kdecore/kkeyserver_x11.cpp -- an
initial attempt to make the Print key work on Solaris instead of being
converted to Ctrl+B.
Comment 18 Ellis Whitehead 2003-04-09 01:44:49 UTC
Comment on attachment 1327 [details]
Patch for Sun's F22/Print key

Woops -- wrong patch
Comment 19 Ellis Whitehead 2003-04-09 01:46:21 UTC
Created attachment 1328 [details]
The right patch file this time...

Please try this one instead -- the last one was the wrong file
Comment 20 Ellis Whitehead 2003-05-18 00:04:55 UTC
I committed the patch to HEAD, so someone who is running head please let me know if 
it works. 
Comment 21 Aaron J. Seigo 2003-06-19 00:26:56 UTC
misty on IRC confirms that it works. thanks Ellis =)))