Changeset View
Changeset View
Standalone View
Standalone View
activation.cpp
Show First 20 Lines • Show All 213 Lines • ▼ Show 20 Line(s) | |||||
214 | */ | 214 | */ | ||
215 | 215 | | |||
216 | 216 | | |||
217 | //**************************************** | 217 | //**************************************** | ||
218 | // Workspace | 218 | // Workspace | ||
219 | //**************************************** | 219 | //**************************************** | ||
220 | 220 | | |||
221 | 221 | | |||
222 | /*! | 222 | /** | ||
223 | Informs the workspace about the active client, i.e. the client that | 223 | * Informs the workspace about the active client, i.e. the client that | ||
224 | has the focus (or None if no client has the focus). This functions | 224 | * has the focus (or None if no client has the focus). This functions | ||
225 | is called by the client itself that gets focus. It has no other | 225 | * is called by the client itself that gets focus. It has no other | ||
226 | effect than fixing the focus chain and the return value of | 226 | * effect than fixing the focus chain and the return value of | ||
227 | activeClient(). And of course, to propagate the active client to the | 227 | * activeClient(). And of course, to propagate the active client to the | ||
228 | world. | 228 | * world. | ||
229 | */ | 229 | **/ | ||
230 | void Workspace::setActiveClient(AbstractClient* c) | 230 | void Workspace::setActiveClient(AbstractClient* c) | ||
231 | { | 231 | { | ||
232 | if (active_client == c) | 232 | if (active_client == c) | ||
233 | return; | 233 | return; | ||
234 | 234 | | |||
235 | if (active_popup && active_popup_client != c && set_active_client_recursion == 0) | 235 | if (active_popup && active_popup_client != c && set_active_client_recursion == 0) | ||
236 | closeActivePopup(); | 236 | closeActivePopup(); | ||
237 | if (m_userActionsMenu->hasClient() && !m_userActionsMenu->isMenuClient(c) && set_active_client_recursion == 0) { | 237 | if (m_userActionsMenu->hasClient() && !m_userActionsMenu->isMenuClient(c) && set_active_client_recursion == 0) { | ||
Show All 35 Lines | |||||
273 | if (rootInfo()) { | 273 | if (rootInfo()) { | ||
274 | rootInfo()->setActiveClient(active_client); | 274 | rootInfo()->setActiveClient(active_client); | ||
275 | } | 275 | } | ||
276 | 276 | | |||
277 | emit clientActivated(active_client); | 277 | emit clientActivated(active_client); | ||
278 | --set_active_client_recursion; | 278 | --set_active_client_recursion; | ||
279 | } | 279 | } | ||
280 | 280 | | |||
281 | /*! | 281 | /** | ||
282 | Tries to activate the client \a c. This function performs what you | 282 | * Tries to activate the client \a c. This function performs what you | ||
283 | expect when clicking the respective entry in a taskbar: showing and | 283 | * expect when clicking the respective entry in a taskbar: showing and | ||
284 | raising the client (this may imply switching to the another virtual | 284 | * raising the client (this may imply switching to the another virtual | ||
285 | desktop) and putting the focus onto it. Once X really gave focus to | 285 | * desktop) and putting the focus onto it. Once X really gave focus to | ||
286 | the client window as requested, the client itself will call | 286 | * the client window as requested, the client itself will call | ||
287 | setActiveClient() and the operation is complete. This may not happen | 287 | * setActiveClient() and the operation is complete. This may not happen | ||
288 | with certain focus policies, though. | 288 | * with certain focus policies, though. | ||
289 | 289 | * | |||
290 | \sa stActiveClient(), requestFocus() | 290 | * @see setActiveClient | ||
291 | */ | 291 | * @see requestFocus | ||
292 | **/ | ||||
292 | void Workspace::activateClient(AbstractClient* c, bool force) | 293 | void Workspace::activateClient(AbstractClient* c, bool force) | ||
293 | { | 294 | { | ||
294 | if (c == NULL) { | 295 | if (c == NULL) { | ||
295 | focusToNull(); | 296 | focusToNull(); | ||
296 | setActiveClient(NULL); | 297 | setActiveClient(NULL); | ||
297 | return; | 298 | return; | ||
298 | } | 299 | } | ||
299 | raiseClient(c); | 300 | raiseClient(c); | ||
Show All 28 Lines | 320 | // TODO force should perhaps allow this only if the window already contains the mouse | |||
328 | // and then kdesktop shows dialog about SSL certificate. | 329 | // and then kdesktop shows dialog about SSL certificate. | ||
329 | // This needs also avoiding user creation time in Client::readUserTimeMapTimestamp(). | 330 | // This needs also avoiding user creation time in Client::readUserTimeMapTimestamp(). | ||
330 | if (Client *client = dynamic_cast<Client*>(c)) { | 331 | if (Client *client = dynamic_cast<Client*>(c)) { | ||
331 | // updateUserTime is X11 specific | 332 | // updateUserTime is X11 specific | ||
332 | client->updateUserTime(); | 333 | client->updateUserTime(); | ||
333 | } | 334 | } | ||
334 | } | 335 | } | ||
335 | 336 | | |||
336 | /*! | 337 | /** | ||
337 | Tries to activate the client by asking X for the input focus. This | 338 | * Tries to activate the client by asking X for the input focus. This | ||
338 | function does not perform any show, raise or desktop switching. See | 339 | * function does not perform any show, raise or desktop switching. See | ||
339 | Workspace::activateClient() instead. | 340 | * Workspace::activateClient() instead. | ||
340 | 341 | * | |||
341 | \sa Workspace::activateClient() | 342 | * @see activateClient | ||
342 | */ | 343 | **/ | ||
343 | void Workspace::requestFocus(AbstractClient* c, bool force) | 344 | void Workspace::requestFocus(AbstractClient* c, bool force) | ||
344 | { | 345 | { | ||
345 | takeActivity(c, force ? ActivityFocusForce : ActivityFocus); | 346 | takeActivity(c, force ? ActivityFocusForce : ActivityFocus); | ||
346 | } | 347 | } | ||
347 | 348 | | |||
348 | void Workspace::takeActivity(AbstractClient* c, ActivityFlags flags) | 349 | void Workspace::takeActivity(AbstractClient* c, ActivityFlags flags) | ||
349 | { | 350 | { | ||
350 | // the 'if ( c == active_client ) return;' optimization mustn't be done here | 351 | // the 'if ( c == active_client ) return;' optimization mustn't be done here | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 399 | if (flags & ActivityFocus) | |||
399 | c->takeFocus(); | 400 | c->takeFocus(); | ||
400 | if (flags & ActivityRaise) | 401 | if (flags & ActivityRaise) | ||
401 | workspace()->raiseClient(c); | 402 | workspace()->raiseClient(c); | ||
402 | 403 | | |||
403 | if (!c->isOnActiveScreen()) | 404 | if (!c->isOnActiveScreen()) | ||
404 | screens()->setCurrent(c->screen()); | 405 | screens()->setCurrent(c->screen()); | ||
405 | } | 406 | } | ||
406 | 407 | | |||
407 | /*! | 408 | /** | ||
408 | Informs the workspace that the client \a c has been hidden. If it | 409 | * Informs the workspace that the client \a c has been hidden. If it | ||
409 | was the active client (or to-become the active client), | 410 | * was the active client (or to-become the active client), | ||
410 | the workspace activates another one. | 411 | * the workspace activates another one. | ||
411 | 412 | * | |||
412 | \a c may already be destroyed | 413 | * @note @p c may already be destroyed. | ||
413 | */ | 414 | **/ | ||
414 | void Workspace::clientHidden(AbstractClient* c) | 415 | void Workspace::clientHidden(AbstractClient* c) | ||
415 | { | 416 | { | ||
416 | assert(!c->isShown(true) || !c->isOnCurrentDesktop() || !c->isOnCurrentActivity()); | 417 | assert(!c->isShown(true) || !c->isOnCurrentDesktop() || !c->isOnCurrentActivity()); | ||
417 | activateNextClient(c); | 418 | activateNextClient(c); | ||
418 | } | 419 | } | ||
419 | 420 | | |||
420 | AbstractClient *Workspace::clientUnderMouse(int screen) const | 421 | AbstractClient *Workspace::clientUnderMouse(int screen) const | ||
421 | { | 422 | { | ||
▲ Show 20 Lines • Show All 273 Lines • ▼ Show 20 Line(s) | 695 | } else | |||
695 | attention_chain.removeAll(c); | 696 | attention_chain.removeAll(c); | ||
696 | emit clientDemandsAttentionChanged(c, set); | 697 | emit clientDemandsAttentionChanged(c, set); | ||
697 | } | 698 | } | ||
698 | 699 | | |||
699 | //******************************************** | 700 | //******************************************** | ||
700 | // Client | 701 | // Client | ||
701 | //******************************************** | 702 | //******************************************** | ||
702 | 703 | | |||
703 | /*! | 704 | /** | ||
704 | Updates the user time (time of last action in the active window). | 705 | * Updates the user time (time of last action in the active window). | ||
705 | This is called inside kwin for every action with the window | 706 | * This is called inside kwin for every action with the window | ||
706 | that qualifies for user interaction (clicking on it, activate it | 707 | * that qualifies for user interaction (clicking on it, activate it | ||
707 | externally, etc.). | 708 | * externally, etc.). | ||
708 | */ | 709 | **/ | ||
709 | void Client::updateUserTime(xcb_timestamp_t time) | 710 | void Client::updateUserTime(xcb_timestamp_t time) | ||
710 | { | 711 | { | ||
711 | // copied in Group::updateUserTime | 712 | // copied in Group::updateUserTime | ||
712 | if (time == XCB_TIME_CURRENT_TIME) { | 713 | if (time == XCB_TIME_CURRENT_TIME) { | ||
713 | updateXTime(); | 714 | updateXTime(); | ||
714 | time = xTime(); | 715 | time = xTime(); | ||
715 | } | 716 | } | ||
716 | if (time != -1U | 717 | if (time != -1U | ||
▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines |