Posts Tagged ‘KDocker’
* KDocker Ubuntu PPA Updated
Posted on May 30th, 2011 by John. Filed under KDocker.
I’ve updated the Ubuntu PPA for KDocker. It now includes the 4.6 release for Lucid, Maveric and Natty. Amd64 and i386 architectures have packages ready to go.
* KDocker 4.6 Released
Posted on May 29th, 2011 by John. Filed under KDocker.
Version 4.6 is now available for direct download.
This release focus on fixing two bugs when using KDocker with the KWin window manager. It fixes and issue with windows not restoring when the “iconify when minimized” option is set. There is also a small change in how windows are focused after being restored as KWin often didn’t focus restored windows.
* KDocker 4.5 Released
Posted on November 7th, 2010 by John. Filed under KDocker.
Version 4.5 of KDocker is now available for direct download and from the Ubuntu ppa.
Matching by name handling has been simplified in this release. The -y option to force matching by name has been removed. The -n NAME option now works the same as the -n -y combination. Also, name based matching now works whenever -n is used. Previously it would only work when KDocker is used to launch an application. These changes was at user request to make name based matching more intuitive.
* KDocker PPA
Posted on October 17th, 2010 by John. Filed under KDocker.
I’ve updated the Ubuntu PPA for KDocker. 4.4 is now packaged for Ubuntu 10.04 and 10.10. I wasn’t planning on continuing with the PPA but it was requested by a user.
I plan to keep the PPA going for the latest released version and the latest LTS version until Ubuntu decides to include non-borken and up to date (at least the version released months before the Ubuntu release) packages.
* KDocker 4.4 Released
Posted on July 17th, 2010 by John. Filed under KDocker.
I’ve released KDocker 4.4 today. It is mostly bug fixes and clean up. However, there is one major change. The feature to dock when the window decorator close button (the x in the upper corner) is clicked has been removed. This feature was introduced in 4.3 and I really like how it. It gives KDocker a feature that no similar application has. However, I was not able to keep it due to a number of issues it introduced.
The dock when closed feature was implemented via XEmbed. Basically I was creating my own window mimicking the window border of the application’s window. I would then remove the border from the application’s window and embed it into my window. Events would be passed from my window into the embedded window. This should work just fine in theory but it didn’t work out so nicely. Embedding caused five issues. The first four are serious and the last is only an annoyance.
The most serious issue was, it broke drag and drop. This looks to be an issue with X itself because I could recreate the problem using Qt and GTK’s embed support as well as writing the embed calls myself using xlib.
Another issue it caused related to support windows. When the main window was embedded it broke the connection between the main window and it’s support windows. So when docking the main window there were issues docking the applications other windows. This is an issue for applications such as XMMS and the Gimp.
Embedding didn’t get along very well with borderless windows. Applications like Chrome and XMMS draw their own window border in place of using the window manager’s decorations. These applications have special handling for moving when clicking and dragging their border. When they are embedded you end up with one of two situations. You can click and drag the window but only in the container window. So instead of moving the window you just move the window’s contents. The other situation is moving via the border doesn’t work at all. In this case resizing doesn’t work either. Oh, and the minimize, maximize, close buttons might not work either. In both cases you can still move the window using alt+left mouse button but this isn’t ideal.
Focus handling with embedded windows didn’t work correctly between different window managers and possibly different versions of Xorg. Some combinations it was fine. Others focus handling only followed the mouse. There were issues with the embedded window never getting focus or only getting focus when using alt+tab to select the window after it was docked.
The only annoying issue that I was okay with having was when undocking a window the window manager (compiz) would cause it to move a little bit. When undocking the position of the container window is recorded, the embedded window is removed from the container and moved to it’s location. Then the container window is destroyed. Compiz didn’t like placing two windows in the exact same place and kept moving the second window down and right by the size of the decoration and frame. This isn’t a very big issue but I really don’t want to have window manager specific work arounds in the code base.
The decision to remove iconify on close wasn’t taken lightly. It was only due to the large number of issues it created. There is not point in using KDocker if it is only going to make docked applications unusable. I have created a branch for iconify on close so I can hopefully get it working properly.
* KDocker 4.3 Released
Posted on November 10th, 2009 by John. Filed under KDocker.
Large parts of the application have been restructured. For instance QtSingleApplication is now being used. The major new feature is the window manager decoration close button (X at the top right) can now optionally iconify the window when clicked. The -c command line option has also changed. It no longer creates a borderless window it now disables the iconify behavior of the decoration close button.
Note: There is one known issue with this release. Drag and Drop is partly broken for docked windows.
* Sending WM_DELETE_WINDOW client messages
Posted on November 8th, 2009 by John. Filed under KDocker, programming.
In my X11 Intercept Window Close Event post I left out one very important piece of information. How to actually close the embedded window after intercepting the WM_DELETE_WINDOW message. The best thing to do is send our own WM_DELETE_WINDOW message to the embedded window. This will keep the embedded window embedded until it actually closes. Meaning any question dialogs that might stop the window from closing (Gedit asking to save for instance) can be answered and it keeps the window embedded if the user decides not to close.
In the previous post we overrode the WM_DELETE_WINDOW message. All we need to do is send it on to the embedded window. This will keep it embedded until it actually closes. Sending a this message entails setting the type to ClinetMessage, message type to the WM_PROTOCOLS Atom, the first l data value to the WM_DELETE_WINDOW Atom, and the second l data value to CurrentTime. The format of course if 32. Send the message to the embedded window and it will try to close.
#include <QX11Info> #include <X11/XLib.h> Display *display = QX11Info::display(); XEvent ev; memset(&ev, 0, sizeof (ev)); ev.xclient.type = ClientMessage; ev.xclient.window = window; ev.xclient.message_type = XInternAtom(display, "WM_PROTOCOLS", true); ev.xclient.format = 32; ev.xclient.data.l[0] = XInternAtom(display, "WM_DELETE_WINDOW", false); ev.xclient.data.l[1] = CurrentTime; XSendEvent(display, window, False, NoEventMask, &ev);
* X11 Intercept Window Close Event
Posted on November 1st, 2009 by John. Filed under KDocker, programming.
***Note Nov, 8 2009: a few additions have been made to the code samples to make them more complete. Specifically subscribing to X11 events.
A feature request for KDocker was made a few days ago for docking when closed. Basically the person wants the window to iconify when the X button on the window decoration is clicked. It’s something I’ve been thinking about for quite some time but it’s not the easiest feature to implement. Girish thankfully pointed me onto the right path when he suggested looking into using a QX11EmbedContainer. I’ve gotten it working and it will be in the 4.3 release.
There isn’t a whole lot of documentation out there on achieving this so I’m going to detail how I’ve implemented the feature in KDocker. Do be awhare that there are a few short comings. Versions <= 4.2 will iconify all windows associated with the docked one. Meaning Gimp and Audacious (XMMS) which have multiple windows will not have the extra windows iconify when the main one is. Also, decorationless windows like audacious (possibly Google Chrome) are no longer movable by clicking on the top of the window. Alt+Left Mouse Click still works and is currently the only way to move them.
The basic overview of the implementation is: Take the user started application window and get info about it (title, size, location, window decorations …). Create a container window. Use XEmbed to put the window into the container. Set the container properties to those of the window. Intercept the WM_DELETE_WINDOW message. Forward other changes like title and icon from the window to the container.
Getting info about the window requires Xlib calls. I’m using the following to get the minimum size, current size, position, width, height and decorations. window is the window id for the application window. The decoration code requires mwmutil.h which can be found in libmotif and LessTif.
Display *display = QX11Info::display(); XSizeHints sizeHint; long dummy; Window root; int x, y; unsigned int width, height, border, depth; XGetWMNormalHints(display, window, &sizeHint, &dummy); XGetGeometry(display, window, &root, &x, &y, &width, &height, &border, &depth); Atom wm_hints_atom = XInternAtom(display, _XA_MOTIF_WM_HINTS, false); unsigned char *wm_data; Atom wm_type; int wm_format; unsigned long wm_nitems, wm_bytes_after; XGetWindowProperty(display, window, wm_hints_atom, 0, sizeof (MotifWmHints) / sizeof (long), false, AnyPropertyType, &wm_type, &wm_format, &wm_nitems, &wm_bytes_after, &wm_data);
Next create the container. I’m using QX11EmbedContainer because it is is a Qt provided XEmbed container widget.
QX11EmbedContainer *container = new QX11EmbedContainer(); container->embedClient(window); container->show();
We need to tell X that we want to receive certain events about the container and embedded window. If we don’t set the appropriate masks the events we are interested in will never be sent to our X11EventFilter.
long mask_container = StructureNotifyMask | PropertyChangeMask | VisibilityChangeMask | FocusChangeMask; long mask_embed = PropertyChangeMask; XWindowAttributes attr_container; XWindowAttributes attr_embed; XGetWindowAttributes(display, m_container->winId(), &attr_container); XGetWindowAttributes(display, window, &attr_embed); if ((attr_container.your_event_mask & mask_container) != mask_container)) { XSelectInput(display, m_container->winId(), attr_container.your_event_mask | mask_container); } if ((attr_container.your_event_mask & mask_embed) != mask_embed)) { XSelectInput(display, window, attr_embed.your_event_mask | mask_embed); }
Now we want to register WM_DELETE_WINDOW so that instead of closing it will be directed to us as a client message. We will check for the message in the X11EventFilter and take appropriate action. This will only work because we have reparented the window by embedding it into the container we control. Simply setting this on the window will not work.
Atom wm_delete = XInternAtom(display, "WM_DELETE_WINDOW", False); XSetWMProtocols(display, container->winId(), &wm_delete, 1);
Take all the info we obtained from the window and apply it to our container. This way it will look and behave the same as if it was not embedded.
m_container->setMinimumSize(m_sizeHint.min_width, m_sizeHint.min_height); m_container->setGeometry(x, y, width, height); if (wm_type == None) { MotifWmHints hints; memset(&hints, 0, sizeof (hints)); hints.flags = MWM_HINTS_DECORATIONS; hints.decorations = MWM_DECOR_ALL; XChangeProperty(display, m_container->winId(), wm_hints_atom, wm_hints_atom, 32, PropModeReplace, (unsigned char *) & hints, sizeof (MotifWmHints) / sizeof (long)); } else { MotifWmHints *hints; hints = (MotifWmHints *) wm_data; if (!(hints->flags & MWM_HINTS_DECORATIONS)) { hints->flags |= MWM_HINTS_DECORATIONS; hints->decorations = 0; } XChangeProperty(display, m_container->winId(), wm_hints_atom, wm_hints_atom, 32, PropModeReplace, (unsigned char *) hints, sizeof (MotifWmHints) / sizeof (long)); } XFree(wm_data);
Thats it for constructing the window but there are a few important pieces we still need to worry about. Within QApplication’s x11EventFilter we need to processes some events.
bool x11EventFilter(XEvent *ev) { XAnyEvent *event = (XAnyEvent *) ev; if (event->window == m_container->winId()) { if (ev->type == ClientMessage && (ulong) ev->xclient.data.l[0] == XInternAtom(QX11Info::display(), "WM_DELETE_WINDOW", False)) { if (m_iconifyOnClose) { iconifyWindow(); } else { close(); } return true; } } if (event->window == window) { if (event->type == PropertyNotify) { return propertyChangeEvent(((XPropertyEvent *) event)->atom); } } return false } bool propertyChangeEvent(Atom property) { Display *display = QX11Info::display(); static Atom WM_NAME = XInternAtom(display, "WM_NAME", True); if (property == WM_NAME) { updateTitle(); return true; } } void updateTitle() { Display *display = QX11Info::display(); char *windowName = 0; QString title; XFetchName(display, window, &windowName); title = windowName; if (windowName) { XFree(windowName); } container->setWindowTitle(title); }
* KDocker 4.2 released
Posted on September 27th, 2009 by John. Filed under KDocker.
This release includes bug fixes as usual. Some new features: bash completion, iconify on focus lost option and Italian translation thanks to Alessio Cassibba. There is also a small change to the behavior when activating the tray icon. If the window is not visible it will become active and if it is active it will iconify. You can get it at the launchpad page.
Somehow I forget to mention the 4.1 release last week… I don’t think I’m going to be getting into the habit of making a release each week but there is still more I have planned. Mostly refactoring, and not to much in the way of new features.
* KDocker 4.0
Posted on September 16th, 2009 by John. Filed under KDocker.
Recently I’ve become the maintainer of the KDocker project. KDocker is a Qt application what allows you dock any application into the system tray. It currently supports any X Windows system. What I’ve done for the 4.0 release is, move the project to launchpad (Girish, the creator of the project is locked out of the Source Forge page) and port/re-write the entire app to use Qt 4.
The port/re-write to Qt 4 is complete and I’ve released it. The version has jumped from 1.3 to 4.0 to better illustrate the the severity of this change. Also, it takes it to a similar version scheme to Qt and KDE.
There are a few things to note about this release and KDocker in general. For this release session management and auto starting have been removed. This is mainly because modern desktop environments support both of these very well. Also, I believe that environments that do not support this are better of using a dedicated application instead of having the functionality rolled into a docker. Another point to note is KDocker 4.0 as well as the older version are pure Qt and Xlib applications. They do not depend on KDE.
The new project location is at https://launchpad.net/kdocker and you can download the 4.0 release at https://launchpad.net/kdocker/+download.
Tags
Archives
- January 2012 (3)
- December 2011 (2)
- November 2011 (1)
- October 2011 (3)
- September 2011 (9)
- August 2011 (15)
- July 2011 (5)
- June 2011 (3)
- May 2011 (4)
- April 2011 (2)
- March 2011 (2)
- February 2011 (4)
- January 2011 (4)
- December 2010 (2)
- November 2010 (1)
- October 2010 (1)
- August 2010 (3)
- July 2010 (4)
- June 2010 (1)
- May 2010 (2)
- March 2010 (1)
- January 2010 (8)
- December 2009 (5)
- November 2009 (6)
- October 2009 (4)
- September 2009 (2)
- August 2009 (6)
- July 2009 (6)
- June 2009 (4)
- May 2009 (6)
- April 2009 (4)
- March 2009 (2)
- February 2009 (4)
- January 2009 (4)
- December 2008 (7)
- November 2008 (2)