|
|
@ -48,7 +48,7 @@ const int XKeyRelease = KeyRelease;
|
|
|
|
|
|
|
|
|
|
|
|
KeyCaptureDialog::KeyCaptureDialog(TQWidget *parent, const char *name)
|
|
|
|
KeyCaptureDialog::KeyCaptureDialog(TQWidget *parent, const char *name)
|
|
|
|
: KDialogBase(parent, name, true, i18n( "Enter Key Combination" ),
|
|
|
|
: KDialogBase(parent, name, true, i18n( "Enter Key Combination" ),
|
|
|
|
Cancel, Cancel, true), m_grabbed(false) {
|
|
|
|
Cancel, Cancel, true) {
|
|
|
|
TQFrame *main = makeMainWidget();
|
|
|
|
TQFrame *main = makeMainWidget();
|
|
|
|
TQVBoxLayout *layout = new TQVBoxLayout( main, 0, KDialog::spacingHint() );
|
|
|
|
TQVBoxLayout *layout = new TQVBoxLayout( main, 0, KDialog::spacingHint() );
|
|
|
|
m_captureWidget = new KeyCaptureWidget( main, "m_captureWidget" );
|
|
|
|
m_captureWidget = new KeyCaptureWidget( main, "m_captureWidget" );
|
|
|
@ -57,15 +57,13 @@ KeyCaptureDialog::KeyCaptureDialog(TQWidget *parent, const char *name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
KeyCaptureDialog::~KeyCaptureDialog() {
|
|
|
|
KeyCaptureDialog::~KeyCaptureDialog() {
|
|
|
|
if (m_grabbed)
|
|
|
|
releaseKeyboard();
|
|
|
|
releaseKeyboard();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KeyCaptureDialog::execute() {
|
|
|
|
void KeyCaptureDialog::execute() {
|
|
|
|
m_captureWidget->keyLabel->setText("");
|
|
|
|
m_captureWidget->keyLabel->setText("");
|
|
|
|
exec();
|
|
|
|
exec();
|
|
|
|
if (m_grabbed)
|
|
|
|
releaseKeyboard();
|
|
|
|
releaseKeyboard();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool KeyCaptureDialog::x11Event(XEvent *pEvent)
|
|
|
|
bool KeyCaptureDialog::x11Event(XEvent *pEvent)
|
|
|
@ -76,17 +74,25 @@ bool KeyCaptureDialog::x11Event(XEvent *pEvent)
|
|
|
|
x11EventKeyPress( pEvent );
|
|
|
|
x11EventKeyPress( pEvent );
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
case XFocusIn:
|
|
|
|
case XFocusIn:
|
|
|
|
if (!m_grabbed)
|
|
|
|
{
|
|
|
|
grabKeyboard();
|
|
|
|
XFocusInEvent *fie = (XFocusInEvent*)pEvent;
|
|
|
|
return true;
|
|
|
|
if (fie->mode != NotifyGrab && fie->mode != NotifyUngrab) {
|
|
|
|
|
|
|
|
grabKeyboard();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
case XFocusOut:
|
|
|
|
case XFocusOut:
|
|
|
|
if (m_grabbed)
|
|
|
|
{
|
|
|
|
releaseKeyboard();
|
|
|
|
XFocusOutEvent *foe = (XFocusOutEvent*)pEvent;
|
|
|
|
return true;
|
|
|
|
if (foe->mode != NotifyGrab && foe->mode != NotifyUngrab) {
|
|
|
|
|
|
|
|
releaseKeyboard();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TQWidget::x11Event( pEvent );
|
|
|
|
return KDialogBase::x11Event( pEvent );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void KeyCaptureDialog::x11EventKeyPress( XEvent *pEvent )
|
|
|
|
void KeyCaptureDialog::x11EventKeyPress( XEvent *pEvent )
|
|
|
|