~ubuntu-branches/ubuntu/precise/unity-2d/precise-security

« back to all changes in this revision

Viewing changes to libunity-2d-private/src/keymonitor.cpp

  • Committer: Package Import Robot
  • Author(s): Didier Roche, Didier Roche, Aurélien Gâteau
  • Date: 2012-01-13 09:12:36 UTC
  • mfrom: (1.1.25)
  • Revision ID: package-import@ubuntu.com-20120113091236-844z32uco10hs6ym
Tags: 5.2.0-0ubuntu1
[ Didier Roche ]
* New upstream release:
  - Select quicklist items with just one right click (LP: #688830)
  - Launcher - Dragging and dropping a running application in to the Trash
    should quit the application and (if the app is pinned to the Launcher)
    un-pin the application from the Launcher (LP: #870143)
  - Dash - "See more..." line should be base-aligned with section header
    (LP: #748101)
  - right click on the dash icon should display a list of the lenses
    (LP: #868452)
  - Top Bar - rename the "Desktop" title in the Top Bar (displayed when no
    window has focus)  to "Ubuntu Desktop" (LP: #869873)
  - Application title on quicklist should be bold (or more visible)
    (LP: #900400)
  - unity-2d-launcher crashed with SIGSEGV  when opening a folder on a CD
    (LP: #831868)
  - unity-2d-places crashed with SIGSEGV in QScriptValue::call()
    (LP: #836498)
  - unity-2d-launcher crashed with SIGSEGV in geis_finish() (LP: #850893)
  - unity-2d-places crashed with SIGABRT in raise() (LP: #857575)
  - unity-2d-launcher crashed with SIGSEGV in exit() (LP: #859596)
  - [spread] layout broken since bzr revision 799 of lp:unity-2d
    (LP: #900895)
  - [workspace switcher] keyboard navigation of workspace switcher broken
    for accessibility (LP: #744978)
  - [spread] workspace switcher performance is poor, especially on low
    powered CPUs (LP: #745764)
  - Launcher - the rendering of the BFB and Lens squircle does not match the
    design (LP: #838708)
  - [dash] Huge performance hit when scrolling search results with
    accessibility enabled (LP: #862956)
  - DBUS_STARTER_ADDRESS and DBUS_STARTER_BUS_TYPE aren't always unset from
    environment making gedit and possibly others fail to start (LP: #873027)
  - Win Key can not be disabled in Unity-2d (LP: #873580)
  - [dash] Unity-2d dash very slow to open (LP: #881756)
  - [tests] LauncherViewTest hanging (LP: #894380)
  - [tests] Unit tests failing due to lack of Xserver (LP: #894381)
  - [launcher] Alt+F1 broken: does not give the focus to the launcher's
    content (LP: #901505)
  - [tests] Add Automated User Experience testing (LP: #903495)
  - [workspace switcher] Performance can be poor when using the opengl
    backend because of window texture sizes that are not limited
    (LP: #808716)
  - [dash] no way to unmaximize (LP: #860400)
  - [launcher] In non-composite mode, background is black (LP: #879288)
  - [dash] Unity 2D shows 'Search' instead of 'Run Command' on ALT + F2
    (LP: #883392)
  - [launcher] Removing icon from launcher makes it hide immediately
    (LP: #884410)
  - OpenGL disabled regardless of use-opengl setting (LP: #887957)
  - if libdir does not equal lib (LP: #888164)
  - [launcher] Launcher stuck open while mouse moved to left corner of panel
    (LP: #892004)
  - [dash] Long results label are truncated instead of elided and a few
    pixels of the next line is visible (LP: #901491)
  - [launcher] Dash icon missing in PPA (LP: #903182)
  - [launcher] Tile context menu should appear at mouse click down event
    (LP: #813036)
  - [launcher] Trash tile highlight is truncated top and bottom
    (LP: #876589)
  - [dash] Text highlighting color is wrong (LP: #880222)
  - [launcher] left edge of panel should not reveal launcher (LP: #891636)
  - [dash] Word "Filter results" has underline when highlighted
    (LP: #893061)
  - [launcher] Alt+F1, change desktop, Alt+F1, hit Esc: launcher doesn't
    give away focus (LP: #897640)
  - Top Bar - rename the "Desktop" title in the Top Bar (displayed when no
    window has focus)  to "Ubuntu Desktop" (LP: #869873)
  - [launcher] Show desktop doesn't show launcher (LP: #898161)
  - [launcher] Context menu/tooltip not positioned at Tile center
    (LP: #898349)
  - The QT_LAYOUT_DIRECTION string needs a translator comment (LP: #863058)
  - unity panel menus don't stay open when clicked on second monitor
    (LP: #869196)
  - Dash- More fixes to layout and alignments (LP: #906235)
* debian/control:
  - bump libunitycore build-dep to 5.0.

[ Aurélien Gâteau ]
* debian/control:
  - bump build-dep versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include "keymonitor.h"
22
22
 
23
23
// Qt
24
 
#include <QtConcurrentRun>
 
24
#include <QSocketNotifier>
25
25
#include <QDebug>
26
26
 
27
27
// X11
38
38
 
39
39
 
40
40
KeyMonitor::KeyMonitor(QObject* parent)
41
 
: QObject(parent), m_stop(false)
 
41
: QObject(parent)
42
42
{
43
43
    if (this->registerEvents()) {
44
44
        getModifiers();
45
 
        m_future = QtConcurrent::run(this, &KeyMonitor::run);
46
45
    }
47
46
}
48
47
 
49
48
KeyMonitor::~KeyMonitor()
50
49
{
51
 
    /* let the running thread know that it should stop */
52
 
    m_stop = true;
53
50
    m_eventList.clear();
 
51
    XCloseDisplay(m_display);
54
52
}
55
53
 
56
54
KeyMonitor* KeyMonitor::instance()
74
72
            m_modList.append(xmodmap->modifiermap[i]);
75
73
        }
76
74
    }
 
75
 
 
76
    XFreeModifiermap(xmodmap);
77
77
}
78
78
 
79
79
bool KeyMonitor::registerEvents()
82
82
    Window window;
83
83
 
84
84
    XDeviceInfo *devices;
 
85
    int x11FileDescriptor;
85
86
    int num_devices;
86
87
    int i, j;
87
88
 
116
117
                }
117
118
            }
118
119
        }
 
120
        XCloseDevice(m_display, device);
119
121
    }
120
122
 
 
123
    XFreeDeviceList(devices);
 
124
 
121
125
    if (m_eventList.size() == 0) {
122
126
        UQ_WARNING << "No input devices found.";
123
127
        return false;
128
132
        return false;
129
133
    }
130
134
 
 
135
    /* Dispatch XEvents when there is activity on the X11 file descriptor */
 
136
    x11FileDescriptor = ConnectionNumber(m_display);
 
137
    QSocketNotifier* socketNotifier = new QSocketNotifier(x11FileDescriptor, QSocketNotifier::Read, this);
 
138
    connect(socketNotifier, SIGNAL(activated(int)), this, SLOT(x11EventDispatch()));
 
139
 
131
140
    return true;
132
141
}
133
142
 
134
143
 
135
 
void KeyMonitor::run()
 
144
void KeyMonitor::x11EventDispatch()
136
145
{
137
146
    XEvent event;
138
147
 
139
 
    while(!m_stop && !XNextEvent(m_display, &event)) {
 
148
    while (XPending(m_display) > 0) {
 
149
        XNextEvent(m_display, &event);
140
150
        if (event.type == key_press_type) {
141
151
            XDeviceKeyEvent *keyEvent = (XDeviceKeyEvent *) &event;
142
152
            if (!m_modList.contains((KeyCode) keyEvent->keycode)) {