From 78dbf8f1c17cc2cbda150dbd027bb31b4f6031e2 Mon Sep 17 00:00:00 2001 From: Jekyll Wu Date: Fri, 2 Mar 2012 00:30:31 +0800 Subject: [PATCH] Remove the left-over & unused code for supporting "Scroll Lock" key It is decided to not reimplement this feature in KDE4 konsole: * It is non-trivial work to implement it correctly * It annoyed some users when it was available in KDE3 konsole * Not many users want this feature back This is a follow up of commit cee0ce539b23b76eac5a582540b22f70ba0a2f74 CCBUG:172271 REVIEW:104156 --- data/keyboard-layouts/default.keytab | 1 - data/keyboard-layouts/linux.keytab | 1 - data/keyboard-layouts/vt420pc.keytab | 1 - src/CMakeLists.txt | 11 -- src/Emulation.h | 11 -- src/KeyboardTranslator.cpp | 4 - src/KeyboardTranslator.h | 2 - src/Pty.cpp | 11 -- src/Pty.h | 11 -- src/Session.cpp | 1 - src/Vt102Emulation.cpp | 5 - src/Vt102Emulation.h | 3 - src/XKB.cpp | 152 --------------------------- src/config-konsole.h.cmake | 6 -- 14 files changed, 220 deletions(-) delete mode 100644 src/XKB.cpp diff --git a/data/keyboard-layouts/default.keytab b/data/keyboard-layouts/default.keytab index fd8343bc..a93feb91 100644 --- a/data/keyboard-layouts/default.keytab +++ b/data/keyboard-layouts/default.keytab @@ -167,5 +167,4 @@ key Down +Shift-AppScreen : scrollLineDown key Next +Shift-AppScreen : scrollPageDown key End +Shift-AppScreen : scrollDownToBottom -key ScrollLock : scrollLock diff --git a/data/keyboard-layouts/linux.keytab b/data/keyboard-layouts/linux.keytab index c0fe4446..d48645d4 100644 --- a/data/keyboard-layouts/linux.keytab +++ b/data/keyboard-layouts/linux.keytab @@ -121,7 +121,6 @@ key Prior +Shift : scrollPageUp key Down +Shift : scrollLineDown key Next +Shift : scrollPageDown -key ScrollLock : scrollLock #---------------------------------------------------------- diff --git a/data/keyboard-layouts/vt420pc.keytab b/data/keyboard-layouts/vt420pc.keytab index ee6aa9ac..3c776bc9 100644 --- a/data/keyboard-layouts/vt420pc.keytab +++ b/data/keyboard-layouts/vt420pc.keytab @@ -156,7 +156,6 @@ key Prior +Shift : scrollPageUp key Down +Shift : scrollLineDown key Next +Shift : scrollPageDown -key ScrollLock : scrollLock #---------------------------------------------------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e04edf47..6d84fa02 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,20 +5,10 @@ if(LIBKONQ_FOUND) include_directories(${LIBKONQ_INCLUDE_DIR}) endif() -### Compile-time features -macro_optional_find_package(XKB) -macro_log_feature(XKB_FOUND "XKB" "X keyboard extension" "http://www.x.org" FALSE "" "Gives Konsole better keyboard support.") - include(CheckIncludeFiles) check_include_files("sys/proc.h" HAVE_SYS_PROC_H) check_include_files("sys/proc_info.h" HAVE_SYS_PROC_INFO_H) -if (APPLE OR OSF) - SET(HAVE_AVOID_XKB TRUE) -endif (APPLE OR OSF) - -macro_bool_to_01(HAVE_AVOID_XKB AVOID_XKB) - configure_file (config-konsole.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-konsole.h ) ############### Load the CTest options ############### @@ -109,7 +99,6 @@ ${CMAKE_CURRENT_BINARY_DIR}/tests/CTestCustom.cmake) ViewProperties.cpp ViewSplitter.cpp Vt102Emulation.cpp - XKB.cpp ZModemDialog.cpp konsole_wcwidth.cpp WindowSystemInfo.cpp diff --git a/src/Emulation.h b/src/Emulation.h index 8390a25c..0ef075ae 100644 --- a/src/Emulation.h +++ b/src/Emulation.h @@ -277,17 +277,6 @@ signals: */ void sendData(const char* data, int len); - /** - * Requests that sending of input to the emulation - * from the terminal process be suspended or resumed. - * - * @param suspend If true, requests that sending of - * input from the terminal process' stdout be - * suspended. Otherwise requests that sending of - * input be resumed. - */ - void lockPtyRequest(bool suspend); - /** * Requests that the pty used by the terminal process * be set to UTF 8 mode. diff --git a/src/KeyboardTranslator.cpp b/src/KeyboardTranslator.cpp index 998373cf..b58cd435 100644 --- a/src/KeyboardTranslator.cpp +++ b/src/KeyboardTranslator.cpp @@ -293,8 +293,6 @@ bool KeyboardTranslatorReader::parseAsCommand(const QString& text, KeyboardTrans command = KeyboardTranslator::ScrollUpToTopCommand; else if (text.compare("scrolldowntobottom", Qt::CaseInsensitive) == 0) command = KeyboardTranslator::ScrollDownToBottomCommand; - else if (text.compare("scrolllock", Qt::CaseInsensitive) == 0) - command = KeyboardTranslator::ScrollLockCommand; else return false; @@ -734,8 +732,6 @@ QString KeyboardTranslator::Entry::resultToString(bool expandWildCards, return "ScrollUpToTop"; else if (_command == ScrollDownToBottomCommand) return "ScrollDownToBottom"; - else if (_command == ScrollLockCommand) - return "ScrollLock"; return QString(); } diff --git a/src/KeyboardTranslator.h b/src/KeyboardTranslator.h index 95adc6ee..15e7f62c 100644 --- a/src/KeyboardTranslator.h +++ b/src/KeyboardTranslator.h @@ -109,8 +109,6 @@ public: ScrollUpToTopCommand = 32, /** Scroll the terminal display down to the end of history */ ScrollDownToBottomCommand = 64, - /** Toggles scroll lock mode */ - ScrollLockCommand = 128, /** Echos the operating system specific erase character. */ EraseCommand = 256 }; diff --git a/src/Pty.cpp b/src/Pty.cpp index 8a98de6b..a7a8975e 100644 --- a/src/Pty.cpp +++ b/src/Pty.cpp @@ -282,17 +282,6 @@ void Pty::dataReceived() emit receivedData(data.constData(), data.count()); } -void Pty::lockPty(bool lock) -{ - Q_UNUSED(lock); - - //TODO: Support for locking the Pty - //if (lock) - //suspend(); - //else - //resume(); -} - int Pty::foregroundProcessGroup() const { int pid = tcgetpgrp(pty()->masterFd()); diff --git a/src/Pty.h b/src/Pty.h index 65b03b2b..32ab7c66 100644 --- a/src/Pty.h +++ b/src/Pty.h @@ -148,17 +148,6 @@ public slots: */ void setUtf8Mode(bool on); - /** - * Suspend or resume processing of data from the standard - * output of the terminal process. - * - * See K3Process::suspend() and K3Process::resume() - * - * @param lock If true, processing of output is suspended, - * otherwise processing is resumed. - */ - void lockPty(bool lock); - /** * Sends data to the process currently controlling the * teletype ( whose id is returned by foregroundProcessGroup() ) diff --git a/src/Session.cpp b/src/Session.cpp index 97137fd1..755dd2a3 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -186,7 +186,6 @@ void Session::openTeletype(int fd) SLOT(onReceiveBlock(const char*,int))); connect(_emulation, SIGNAL(sendData(const char*,int)), _shellProcess, SLOT(sendData(const char*,int))); - connect(_emulation, SIGNAL(lockPtyRequest(bool)), _shellProcess, SLOT(lockPty(bool))); connect(_emulation, SIGNAL(useUtf8Request(bool)), _shellProcess, SLOT(setUtf8Mode(bool))); connect(_shellProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(done(int,QProcess::ExitStatus))); connect(_emulation, SIGNAL(imageSizeChanged(int,int)), this, SLOT(updateWindowSize(int,int))); diff --git a/src/Vt102Emulation.cpp b/src/Vt102Emulation.cpp index de32ce84..322fe97a 100644 --- a/src/Vt102Emulation.cpp +++ b/src/Vt102Emulation.cpp @@ -32,11 +32,6 @@ #undef HAVE_XKB #endif -#if defined(HAVE_XKB) -void scrolllock_set_off(); -void scrolllock_set_on(); -#endif - // Standard #include #include diff --git a/src/Vt102Emulation.h b/src/Vt102Emulation.h index 1311cdd2..4571752c 100644 --- a/src/Vt102Emulation.h +++ b/src/Vt102Emulation.h @@ -156,9 +156,6 @@ private: void reportCursorPosition(); void reportTerminalParms(int p); - void onScrollLock(); - void scrollLock(const bool lock); - // clears the screen and resizes it to the specified // number of columns void clearScreenAndSetColumns(int columnCount); diff --git a/src/XKB.cpp b/src/XKB.cpp deleted file mode 100644 index 4b928e24..00000000 --- a/src/XKB.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* - Originally comes from NumLockX http://dforce.sh.charactervut.characterz/~seli/en/numlockx - - NumLockX - - Copyright 2000-2001 Lubos Lunak - Copyright 2001 Oswald Buddenhagen - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - -****************************************************************************/ - -#include - -#if defined(HAVE_XKB) && !defined(AVOID_XKB) -#include - - -#include - -#define explicit myexplicit -#include -#undef explicit - -#include - -/* the XKB stuff is based on code created by Oswald Buddenhagen */ -int xkb_init() -{ - int xkb_opcode, xkb_event, xkb_error; - int xkb_lmaj = XkbMajorVersion; - int xkb_lmin = XkbMinorVersion; - return XkbLibraryVersion(&xkb_lmaj, &xkb_lmin) - && XkbQueryExtension(QX11Info::display(), &xkb_opcode, &xkb_event, &xkb_error, - &xkb_lmaj, &xkb_lmin); -} - -#if 0 -// This method doesn't work in all cases. The atom "ScrollLock" doesn't seem -// to exist on all XFree versions (at least it's not here with my 3.3.6) - DF -static unsigned int xkb_mask_modifier(XkbDescPtr xkb, const char* name) -{ - int i; - if (!xkb || !xkb->names) - return 0; - - Atom atom = XInternAtom(xkb->dpy, name, true); - if (atom == None) - return 0; - - for (i = 0; - i < XkbNumVirtualMods; - i++) { - if (atom == xkb->names->vmods[i]) { - unsigned int mask; - XkbVirtualModsToReal(xkb, 1 << i, &mask); - return mask; - } - } - return 0; -} - -static unsigned int xkb_scrolllock_mask() -{ - XkbDescPtr xkb; - if ((xkb = XkbGetKeyboard(QX11Info::display(), XkbAllComponentsMask, XkbUseCoreKbd)) != NULL) { - unsigned int mask = xkb_mask_modifier(xkb, "ScrollLock"); - XkbFreeKeyboard(xkb, 0, True); - return mask; - } - return 0; -} - -#else -unsigned int xkb_scrolllock_mask() -{ - int scrolllock_mask = 0; - XModifierKeymap* map = XGetModifierMapping(QX11Info::display()); - KeyCode scrolllock_keycode = XKeysymToKeycode(QX11Info::display(), XK_Scroll_Lock); - if (scrolllock_keycode == NoSymbol) { - XFreeModifiermap(map); - return 0; - } - for (int i = 0; - i < 8; - ++i) { - if (map->modifiermap[ map->max_keypermod * i ] == scrolllock_keycode) - scrolllock_mask += 1 << i; - } - - XFreeModifiermap(map); - return scrolllock_mask; -} -#endif - - -unsigned int scrolllock_mask = 0; - -int xkb_set_on() -{ - if (!scrolllock_mask) { - if (!xkb_init()) - return 0; - scrolllock_mask = xkb_scrolllock_mask(); - if (scrolllock_mask == 0) - return 0; - } - XkbLockModifiers(QX11Info::display(), XkbUseCoreKbd, scrolllock_mask, scrolllock_mask); - return 1; -} - -int xkb_set_off() -{ - if (!scrolllock_mask) { - if (!xkb_init()) - return 0; - scrolllock_mask = xkb_scrolllock_mask(); - if (scrolllock_mask == 0) - return 0; - } - XkbLockModifiers(QX11Info::display(), XkbUseCoreKbd, scrolllock_mask, 0); - return 1; -} - -void scrolllock_set_on() -{ - xkb_set_on(); -} - -void scrolllock_set_off() -{ - xkb_set_off(); -} - -#endif // defined(HAVE_XKB) - diff --git a/src/config-konsole.h.cmake b/src/config-konsole.h.cmake index cf3b5e7e..c5855001 100644 --- a/src/config-konsole.h.cmake +++ b/src/config-konsole.h.cmake @@ -1,11 +1,5 @@ -/* Define if you have the XKB extension */ -#cmakedefine HAVE_XKB 1 - /* Defined if you have sys/proc.h */ #cmakedefine HAVE_SYS_PROC_H 1 /* Defined if you have sys/proc_info.h */ #cmakedefine HAVE_SYS_PROC_INFO_H 1 - -/* Define if you have the do NOT want the XKB extension */ -#cmakedefine AVOID_XKB 1