32 Pimpl (
const Image& im, Window windowH) : image (im)
36 auto* display = XWindowSystem::getInstance()->getDisplay();
38 auto* screen = X11Symbols::getInstance()->xDefaultScreenOfDisplay (display);
39 auto screenNumber = X11Symbols::getInstance()->xScreenNumberOfScreen (screen);
41 String screenAtom (
"_NET_SYSTEM_TRAY_S");
42 screenAtom << screenNumber;
43 Atom selectionAtom = XWindowSystemUtilities::Atoms::getCreating (display, screenAtom.
toUTF8());
45 X11Symbols::getInstance()->xGrabServer (display);
46 auto managerWin = X11Symbols::getInstance()->xGetSelectionOwner (display, selectionAtom);
48 if (managerWin != None)
49 X11Symbols::getInstance()->xSelectInput (display, managerWin, StructureNotifyMask);
51 X11Symbols::getInstance()->xUngrabServer (display);
52 X11Symbols::getInstance()->xFlush (display);
54 if (managerWin != None)
57 ev.xclient.type = ClientMessage;
58 ev.xclient.window = managerWin;
59 ev.xclient.message_type = XWindowSystemUtilities::Atoms::getCreating (display,
"_NET_SYSTEM_TRAY_OPCODE");
60 ev.xclient.format = 32;
61 ev.xclient.data.l[0] = CurrentTime;
62 ev.xclient.data.l[1] = 0 ;
63 ev.xclient.data.l[2] = (
long) windowH;
64 ev.xclient.data.l[3] = 0;
65 ev.xclient.data.l[4] = 0;
67 X11Symbols::getInstance()->xSendEvent (display, managerWin, False, NoEventMask, &ev);
68 X11Symbols::getInstance()->xSync (display, False);
73 Atom trayAtom = XWindowSystemUtilities::Atoms::getCreating (display,
"KWM_DOCKWINDOW");
74 X11Symbols::getInstance()->xChangeProperty (display, windowH, trayAtom, trayAtom,
75 32, PropModeReplace, (
unsigned char*) &atomData, 1);
78 trayAtom = XWindowSystemUtilities::Atoms::getCreating (display,
"_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR");
79 X11Symbols::getInstance()->xChangeProperty (display, windowH, trayAtom, XA_WINDOW,
80 32, PropModeReplace, (
unsigned char*) &windowH, 1);
83 if (
auto* hints = X11Symbols::getInstance()->xAllocSizeHints())
85 hints->flags = PMinSize;
86 hints->min_width = 22;
87 hints->min_height = 22;
88 X11Symbols::getInstance()->xSetWMNormalHints (display, windowH, hints);
89 X11Symbols::getInstance()->xFree (hints);
void drawImage(const Image &imageToDraw, int destX, int destY, int destWidth, int destHeight, int sourceX, int sourceY, int sourceWidth, int sourceHeight, bool fillAlphaChannelWithCurrentBrush=false) const
Draws part of an image, rescaling it to fit in a given target region.