LOGIN / SIGN UP
Add Client::sendTakeFocusMessage() and call it from Client::giveInputFocus().
2008-10-10 16:31 3b8e6..6e28d

src/Client.cc
 
499 @@ -499,20 +499,14 @@
499 }
500
501 //! @brief Gives the Client input focus.
502 bool
503 void
504 Client::giveInputFocus(void)
505 {
506 if (_wm_hints_input) {
507 return PWinObj::giveInputFocus();
508 } else if (_send_focus_message) {
509 sendXMessage(_window,
510 IcccmAtoms::instance()->getAtom(WM_PROTOCOLS), NoEventMask,
511 IcccmAtoms::instance()->getAtom(WM_TAKE_FOCUS),
512 PScreen::instance()->getLastEventTime());
513 return true;
514 } else {
515 return true;
516 PWinObj::giveInputFocus();
517 }
518
519 sendTakeFocusMessage();
520 }
521
522 //! @brief Reparents and sets _parent member, filtering unmap events
...
1176 @@ -1182,6 +1176,23 @@
1176 XSendEvent(_dpy, _window, false, StructureNotifyMask, (XEvent *) &e);
1177 }
1178
1179 //! @brief Send a TAKE_FOCUS client message to the client (if requested by it).
1180 void Client::sendTakeFocusMessage(void)
1181 {
1182 if (_send_focus_message) {
1183 {
1184 XEvent ev;
1185 XChangeProperty(_dpy, RootWindow(_dpy, DefaultScreen(_dpy)), XA_PRIMARY, XA_STRING, 8, PropModeAppend, NULL, 0);
1186 XWindowEvent(_dpy, RootWindow(_dpy, DefaultScreen(_dpy)), PropertyChangeMask, &ev);
1187 PScreen::instance()->setLastEventTime(ev.xproperty.time);
1188 }
1189 sendXMessage(_window,
1190 IcccmAtoms::instance()->getAtom(WM_PROTOCOLS), NoEventMask,
1191 IcccmAtoms::instance()->getAtom(WM_TAKE_FOCUS),
1192 PScreen::instance()->getLastEventTime());
1193 }
1194 }
1195
1196 //! @brief Grabs a button on the window win
1197 //! Grabs the button button, with the mod mod and mask mask on the window win
1198 //! and cursor curs with "all" possible extra modifiers
...