Permalink
Browse files

Minor cleanup (mostly formatting).

  • Loading branch information...
user-none committed Apr 10, 2015
1 parent 7d7d4e8 commit 58152a509c64107124da839a0f0f5f91de427f79
Showing with 30 additions and 49 deletions.
  1. +0 −5 BUGS
  2. +3 −0 ChangeLog
  3. +1 −1 INSTALL
  4. +1 −0 src/application.h
  5. +1 −0 src/constants.cpp
  6. +1 −0 src/constants.h
  7. +2 −2 src/kdocker.cpp
  8. +1 −0 src/main.cpp
  9. +7 −19 src/trayitem.cpp
  10. +7 −14 src/trayitemmanager.cpp
  11. +4 −7 src/xlibutil.cpp
  12. +2 −1 src/xlibutil.h
View
5 BUGS
@@ -1,7 +1,2 @@
Bugs and wishes to https://github.com/user-none/KDocker/issues
Known issues:
---
* Robust error reporting from 1.x have not been implemented in 4.x.
View
@@ -1,3 +1,6 @@
for version 5.0
- Support Qt 5.
for version 4.9
- Assorted bug fixed (mostly minimal).
View
@@ -1,5 +1,5 @@
Prerequisites
1. Make sure you have Qt 4 installed and working. If you dont know what Qt is,
1. Make sure you have Qt 5 installed and working. If you dont know what Qt is,
go to http://qt.nokia.com/products/. You will need qmake to compile.
Building
View
@@ -24,6 +24,7 @@
#include "kdocker.h"
class Application : public QtSingleApplication {
Q_OBJECT
View
@@ -19,6 +19,7 @@
#include "constants.h"
const QString Constants::ORG_NAME = "com.kdocker";
const QString Constants::DOM_NAME = "kdocker.com";
const QString Constants::APP_NAME = "KDocker";
View
@@ -23,6 +23,7 @@
#include <QObject>
#include <QString>
class Constants : QObject {
Q_OBJECT
View
@@ -29,6 +29,7 @@
#include <Xlib.h>
#define ARG_MAX_LEN 30
#define ARG_PRE_PAD 2
#define ARG_POST_PAD 2
@@ -45,8 +46,7 @@ KDocker::~KDocker() {
}
}
TrayItemManager *KDocker::getTrayItemManager()
{
TrayItemManager *KDocker::getTrayItemManager() {
return m_trayItemManager;
}
View
@@ -29,6 +29,7 @@
#include "constants.h"
#include "kdocker.h"
static void sighandler(int sig) {
Q_UNUSED(sig);
View
@@ -78,12 +78,9 @@ TrayItem::~TrayItem() {
bool TrayItem::xcbEventFilter(xcb_generic_event_t *event, xcb_window_t dockedWindow)
{
if ( ! isBadWindow() && static_cast<Window>(dockedWindow) == m_window)
{
switch (event-> response_type & ~0x80)
{
bool TrayItem::xcbEventFilter(xcb_generic_event_t *event, xcb_window_t dockedWindow) {
if (!isBadWindow() && static_cast<Window>(dockedWindow) == m_window) {
switch (event-> response_type & ~0x80) {
case XCB_FOCUS_OUT:
focusLostEvent();
break;
@@ -112,9 +109,7 @@ bool TrayItem::xcbEventFilter(xcb_generic_event_t *event, xcb_window_t dockedWin
case XCB_PROPERTY_NOTIFY:
propertyChangeEvent(static_cast<Atom>(reinterpret_cast<xcb_property_notify_event_t *>(event)-> atom));
break;
}
}
return false;
@@ -390,20 +385,13 @@ void TrayItem::propertyChangeEvent(Atom property) {
static Atom WM_STATE = XInternAtom(display, "WM_STATE", True);
static Atom _NET_WM_DESKTOP = XInternAtom(display, "_NET_WM_DESKTOP", True);
if (property == WM_NAME)
{
if (property == WM_NAME) {
updateTitle();
}
else if (property == WM_ICON)
{
} else if (property == WM_ICON) {
updateIcon();
}
else if (property == _NET_WM_DESKTOP)
{
} else if (property == _NET_WM_DESKTOP) {
XLibUtil::getCardinalProperty(display, m_window, _NET_WM_DESKTOP, &m_desktop);
}
else if (property == WM_STATE)
{
} else if (property == WM_STATE) {
Atom type = None;
int format;
unsigned long nitems, after;
View
@@ -34,6 +34,7 @@
#include <Xlib.h>
#define ESC_key 9
int ignoreXErrors(Display *, XErrorEvent *) {
@@ -67,19 +68,14 @@ TrayItemManager::~TrayItemManager() {
delete m_scanner;
}
/*
* The X11 Event Filter. Pass on events to the TrayItems that we created.
*/
bool TrayItemManager::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
{
/* The X11 Event Filter. Pass on events to the TrayItems that we created. */
bool TrayItemManager::nativeEventFilter(const QByteArray &eventType, void *message, long *result) {
Q_UNUSED(eventType); // Platform string; not used
Q_UNUSED(result); // Win* OS only
static xcb_window_t dockedWindow = 0; // zero: event ignored (default) ...
// non-zero: pass to TrayItem::xcbEventFilter
switch (static_cast<xcb_generic_event_t *>(message)-> response_type & ~0x80)
{
switch (static_cast<xcb_generic_event_t *>(message)-> response_type & ~0x80) {
case XCB_FOCUS_OUT: // -> TrayItem::xcbEventFilter
dockedWindow = static_cast<xcb_focus_out_event_t *>(message)-> event;
break;
@@ -105,8 +101,7 @@ bool TrayItemManager::nativeEventFilter(const QByteArray &eventType, void *messa
break;
case XCB_BUTTON_PRESS:
if (m_grabInfo.isGrabbing)
{
if (m_grabInfo.isGrabbing) {
m_grabInfo.isGrabbing = false; // Cancel immediately
m_grabInfo.button = static_cast<xcb_button_press_event_t *>(message)-> detail;
@@ -118,8 +113,7 @@ bool TrayItemManager::nativeEventFilter(const QByteArray &eventType, void *messa
break;
case XCB_KEY_RELEASE:
if (m_grabInfo.isGrabbing)
{
if (m_grabInfo.isGrabbing) {
if (static_cast<xcb_key_release_event_t *>(message)-> detail == ESC_key)
{
m_grabInfo.isGrabbing = false;
@@ -131,8 +125,7 @@ bool TrayItemManager::nativeEventFilter(const QByteArray &eventType, void *messa
break;
}
if (dockedWindow)
{
if (dockedWindow) {
// Pass on the event to the tray item with the associated window.
QListIterator<TrayItem*> ti(m_trayItems);
static TrayItem *t;
View
@@ -28,12 +28,12 @@
#include "xlibutil.h"
#define BIT0 (1 << 0)
#define BIT1 (1 << 1)
#define BIT2 (1 << 2)
#define BIT3 (1 << 3)
/*
* Assert validity of the window id. Get window attributes for the heck of it
* and see if the request went through.
@@ -299,8 +299,7 @@ Window XLibUtil::selectWindow(Display *display, GrabInfo &grabInfo, QString &err
// Cannot use 'AnyModifier' here in case, say, CTRL+ESC is in use (results in failure to grab at all)
//
KeyCode keyEsc = XKeysymToKeycode(display, XK_Escape);
for (int b = 0; b < BIT3; b++) // 000..111 (grab eight Escape key combinations)
{
for (int b = 0; b < BIT3; b++) // 000..111 (grab eight Escape key combinations) {
int modifiers = ((b & BIT0) ? LockMask : 0) | // CAPS_lock
((b & BIT1) ? Mod2Mask : 0) | // NUM_lock
((b & BIT2) ? Mod5Mask : 0); // SCROLL_lock
@@ -324,8 +323,7 @@ Window XLibUtil::selectWindow(Display *display, GrabInfo &grabInfo, QString &err
XSelectInput(display, root, NoEventMask);
XFreeCursor(display, cursor);
if (grabInfo.button != Button1 || !grabInfo.window || !grabInfo.qtimer-> isActive())
{
if (grabInfo.button != Button1 || !grabInfo.window || !grabInfo.qtimer-> isActive()) {
return None;
}
@@ -346,8 +344,7 @@ void XLibUtil::subscribe(Display *display, Window w, long mask) {
XSync(display, false);
}
void XLibUtil::unSubscribe(Display *display, Window w)
{
void XLibUtil::unSubscribe(Display *display, Window w) {
XSelectInput(display, w, NoEventMask);
XSync(display, false);
}
View
@@ -33,9 +33,10 @@
#include <X11/Xlib-xcb.h>
#include <X11/Xutil.h>
#include <Xmu/WinUtil.h>
#undef Bool
#undef Bool
typedef struct GrabInfo {
QTimer *qtimer;

0 comments on commit 58152a5

Please sign in to comment.