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 cee0ce539b

CCBUG:172271
REVIEW:104156
wilder-portage
Jekyll Wu 14 years ago
parent 52406f651d
commit 78dbf8f1c1
  1. 1
      data/keyboard-layouts/default.keytab
  2. 1
      data/keyboard-layouts/linux.keytab
  3. 1
      data/keyboard-layouts/vt420pc.keytab
  4. 11
      src/CMakeLists.txt
  5. 11
      src/Emulation.h
  6. 4
      src/KeyboardTranslator.cpp
  7. 2
      src/KeyboardTranslator.h
  8. 11
      src/Pty.cpp
  9. 11
      src/Pty.h
  10. 1
      src/Session.cpp
  11. 5
      src/Vt102Emulation.cpp
  12. 3
      src/Vt102Emulation.h
  13. 152
      src/XKB.cpp
  14. 6
      src/config-konsole.h.cmake

@ -167,5 +167,4 @@ key Down +Shift-AppScreen : scrollLineDown
key Next +Shift-AppScreen : scrollPageDown
key End +Shift-AppScreen : scrollDownToBottom
key ScrollLock : scrollLock

@ -121,7 +121,6 @@ key Prior +Shift : scrollPageUp
key Down +Shift : scrollLineDown
key Next +Shift : scrollPageDown
key ScrollLock : scrollLock
#----------------------------------------------------------

@ -156,7 +156,6 @@ key Prior +Shift : scrollPageUp
key Down +Shift : scrollLineDown
key Next +Shift : scrollPageDown
key ScrollLock : scrollLock
#----------------------------------------------------------

@ -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

@ -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.

@ -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();
}

@ -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
};

@ -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());

@ -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() )

@ -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)));

@ -32,11 +32,6 @@
#undef HAVE_XKB
#endif
#if defined(HAVE_XKB)
void scrolllock_set_off();
void scrolllock_set_on();
#endif
// Standard
#include <stdio.h>
#include <unistd.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);

@ -1,152 +0,0 @@
/*
Originally comes from NumLockX http://dforce.sh.charactervut.characterz/~seli/en/numlockx
NumLockX
Copyright 2000-2001 Lubos Lunak <l.lunak@kde.org>
Copyright 2001 Oswald Buddenhagen <ossi@kde.org>
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 <config-konsole.h>
#if defined(HAVE_XKB) && !defined(AVOID_XKB)
#include <QtGui/QX11Info>
#include <X11/Xlib.h>
#define explicit myexplicit
#include <X11/XKBlib.h>
#undef explicit
#include <X11/keysym.h>
/* the XKB stuff is based on code created by Oswald Buddenhagen <ossi@kde.org> */
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)

@ -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

Loading…
Cancel
Save