Merge lp:~3v1n0/compiz/cursors-update-on-theme+size-changes into lp:compiz/0.9.12

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: 3955
Merged at revision: 3987
Proposed branch: lp:~3v1n0/compiz/cursors-update-on-theme+size-changes
Merge into: lp:compiz/0.9.12
Prerequisite: lp:~3v1n0/compiz/add-cursor-update-notify
Diff against target: 746 lines (+109/-133)
24 files modified
CMakeLists.txt (+1/-0)
include/core/screen.h (+1/-0)
plugins/expo/src/expo.cpp (+1/-8)
plugins/expo/src/expo.h (+0/-3)
plugins/freewins/src/action.cpp (+1/-5)
plugins/freewins/src/events.cpp (+2/-4)
plugins/freewins/src/freewins.h (+0/-2)
plugins/move/src/move.cpp (+4/-6)
plugins/move/src/move.h (+0/-2)
plugins/resize/src/logic/include/resize-logic.h (+1/-11)
plugins/resize/src/logic/include/screen-interface.h (+1/-0)
plugins/resize/src/logic/src/resize-logic.cpp (+23/-12)
plugins/resize/src/logic/tests/mock-screen.h (+1/-0)
plugins/resize/src/resize.cpp (+0/-37)
plugins/resize/src/screen-impl.h (+5/-0)
plugins/shelf/src/shelf.cpp (+1/-7)
plugins/shelf/src/shelf.h (+0/-1)
plugins/shift/src/shift.cpp (+0/-3)
plugins/shift/src/shift.h (+0/-2)
plugins/widget/src/widget.cpp (+2/-6)
plugins/widget/src/widget.h (+0/-1)
src/privatescreen.h (+6/-3)
src/privatescreen/tests/test-privatescreen.cpp (+1/-0)
src/screen.cpp (+58/-20)
To merge this branch: bzr merge lp:~3v1n0/compiz/cursors-update-on-theme+size-changes
Reviewer Review Type Date Requested Status
Andrea Azzarone Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+275332@code.launchpad.net

This proposal supersedes a proposal from 2015-10-20.

Commit message

Screen: monitor root RESOURCE_MANAGER and update cursors when Size or Theme changes

Also add cursorCache and updateCursors notify function

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

LGTM. Not sure what happend with that diff still around but should not be a problem.

Revision history for this message
Andrea Azzarone (azzar1) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
3955. By Marco Trevisan (Treviño)

Screen: no need to update cursors on startup, we have none of them

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2015-07-30 20:12:45 +0000
+++ CMakeLists.txt 2015-10-22 15:51:58 +0000
@@ -101,6 +101,7 @@
101 xext101 xext
102 xdamage102 xdamage
103 xcomposite103 xcomposite
104 xcursor
104 x11-xcb105 x11-xcb
105 xrandr106 xrandr
106 xinerama107 xinerama
107108
=== modified file 'include/core/screen.h'
--- include/core/screen.h 2015-10-22 15:51:57 +0000
+++ include/core/screen.h 2015-10-22 15:51:58 +0000
@@ -395,6 +395,7 @@
395 virtual const char * displayString () = 0;395 virtual const char * displayString () = 0;
396 virtual CompRect getCurrentOutputExtents () = 0;396 virtual CompRect getCurrentOutputExtents () = 0;
397 virtual Cursor normalCursor () = 0;397 virtual Cursor normalCursor () = 0;
398 virtual Cursor cursorCache (unsigned int cursorName) = 0;
398 virtual bool grabbed () = 0;399 virtual bool grabbed () = 0;
399 virtual SnDisplay * snDisplay () = 0;400 virtual SnDisplay * snDisplay () = 0;
400401
401402
=== modified file 'plugins/expo/src/expo.cpp'
--- plugins/expo/src/expo.cpp 2015-04-10 21:55:21 +0000
+++ plugins/expo/src/expo.cpp 2015-10-22 15:51:58 +0000
@@ -610,7 +610,7 @@
610 CompWindowGrabMoveMask |610 CompWindowGrabMoveMask |
611 CompWindowGrabButtonMask);611 CompWindowGrabButtonMask);
612612
613 screen->updateGrab (grabIndex, dragCursor);613 screen->updateGrab (grabIndex, screen->cursorCache (XC_fleur));
614614
615 w->raise ();615 w->raise ();
616 w->moveInputFocusTo ();616 w->moveInputFocusTo ();
@@ -1578,8 +1578,6 @@
1578 upKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Up"));1578 upKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Up"));
1579 downKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Down"));1579 downKey = XKeysymToKeycode (s->dpy (), XStringToKeysym ("Down"));
15801580
1581 dragCursor = XCreateFontCursor (screen->dpy (), XC_fleur);
1582
1583 EXPOINITBIND (ExpoKey, doExpo);1581 EXPOINITBIND (ExpoKey, doExpo);
1584 EXPOTERMBIND (ExpoKey, termExpo);1582 EXPOTERMBIND (ExpoKey, termExpo);
1585 EXPOINITBIND (ExpoButton, doExpo);1583 EXPOINITBIND (ExpoButton, doExpo);
@@ -1603,11 +1601,6 @@
1603 GL_RGBA, GL_UNSIGNED_BYTE);1601 GL_RGBA, GL_UNSIGNED_BYTE);
1604}1602}
16051603
1606ExpoScreen::~ExpoScreen ()
1607{
1608 if (dragCursor != None)
1609 XFreeCursor (screen->dpy (), dragCursor);
1610}
16111604
1612ExpoWindow::ExpoWindow (CompWindow *w) :1605ExpoWindow::ExpoWindow (CompWindow *w) :
1613 PluginClassHandler<ExpoWindow, CompWindow> (w),1606 PluginClassHandler<ExpoWindow, CompWindow> (w),
16141607
=== modified file 'plugins/expo/src/expo.h'
--- plugins/expo/src/expo.h 2013-07-14 10:38:09 +0000
+++ plugins/expo/src/expo.h 2015-10-22 15:51:58 +0000
@@ -42,7 +42,6 @@
42 public:42 public:
4343
44 ExpoScreen (CompScreen *);44 ExpoScreen (CompScreen *);
45 ~ExpoScreen ();
4645
47 void handleEvent (XEvent *);46 void handleEvent (XEvent *);
4847
@@ -153,8 +152,6 @@
153 KeyCode rightKey;152 KeyCode rightKey;
154 KeyCode upKey;153 KeyCode upKey;
155 KeyCode downKey;154 KeyCode downKey;
156
157 Cursor dragCursor;
158};155};
159156
160class ExpoWindow :157class ExpoWindow :
161158
=== modified file 'plugins/freewins/src/action.cpp'
--- plugins/freewins/src/action.cpp 2013-03-26 22:02:39 +0000
+++ plugins/freewins/src/action.cpp 2015-10-22 15:51:58 +0000
@@ -82,8 +82,6 @@
82 useW = getRealWindow (w);82 useW = getRealWindow (w);
83 }83 }
8484
85 mRotateCursor = XCreateFontCursor (screen->dpy (), XC_fleur);
86
87 if (!screen->otherGrabExist ("freewins", 0))85 if (!screen->otherGrabExist ("freewins", 0))
88 if (!mGrabIndex)86 if (!mGrabIndex)
89 {87 {
@@ -305,11 +303,9 @@
305 useW = getRealWindow (w);303 useW = getRealWindow (w);
306 }304 }
307305
308 mRotateCursor = XCreateFontCursor (screen->dpy (), XC_fleur);
309
310 if (!screen->otherGrabExist ("freewins", 0))306 if (!screen->otherGrabExist ("freewins", 0))
311 if (!mGrabIndex)307 if (!mGrabIndex)
312 mGrabIndex = screen->pushGrab (mRotateCursor, "freewins");308 mGrabIndex = screen->pushGrab (screen->cursorCache(XC_fleur), "freewins");
313 }309 }
314310
315 if (useW)311 if (useW)
316312
=== modified file 'plugins/freewins/src/events.cpp'
--- plugins/freewins/src/events.cpp 2013-03-26 22:02:39 +0000
+++ plugins/freewins/src/events.cpp 2015-10-22 15:51:58 +0000
@@ -60,13 +60,12 @@
6060
61 window->activate ();61 window->activate ();
62 mGrab = grabResize;62 mGrab = grabResize;
63 fws->mRotateCursor = XCreateFontCursor (screen->dpy (), XC_plus);
64 if(!screen->otherGrabExist ("freewins", "resize", 0))63 if(!screen->otherGrabExist ("freewins", "resize", 0))
65 if(!fws->mGrabIndex)64 if(!fws->mGrabIndex)
66 {65 {
67 unsigned int mods = 0;66 unsigned int mods = 0;
68 mods &= CompNoMask;67 mods &= CompNoMask;
69 fws->mGrabIndex = screen->pushGrab (fws->mRotateCursor, "resize");68 fws->mGrabIndex = screen->pushGrab (screen->cursorCache (XC_plus), "resize");
70 window->grabNotify (window->x () + (window->width () / 2),69 window->grabNotify (window->x () + (window->width () / 2),
71 window->y () + (window->height () / 2), mods,70 window->y () + (window->height () / 2), mods,
72 CompWindowGrabMoveMask | CompWindowGrabButtonMask);71 CompWindowGrabMoveMask | CompWindowGrabButtonMask);
@@ -81,13 +80,12 @@
8180
82 window->activate ();81 window->activate ();
83 mGrab = grabMove;82 mGrab = grabMove;
84 fws->mRotateCursor = XCreateFontCursor (screen->dpy (), XC_fleur);
85 if(!screen->otherGrabExist ("freewins", "resize", 0))83 if(!screen->otherGrabExist ("freewins", "resize", 0))
86 if(!fws->mGrabIndex)84 if(!fws->mGrabIndex)
87 {85 {
88 unsigned int mods = 0;86 unsigned int mods = 0;
89 mods &= CompNoMask;87 mods &= CompNoMask;
90 fws->mGrabIndex = screen->pushGrab (fws->mRotateCursor, "resize");88 fws->mGrabIndex = screen->pushGrab (screen->cursorCache (XC_fleur), "resize");
91 window->grabNotify (window->x () + (window->width () / 2),89 window->grabNotify (window->x () + (window->width () / 2),
92 window->y () + (window->height () / 2), mods,90 window->y () + (window->height () / 2), mods,
93 CompWindowGrabResizeMask | CompWindowGrabButtonMask);91 CompWindowGrabResizeMask | CompWindowGrabButtonMask);
9492
=== modified file 'plugins/freewins/src/freewins.h'
--- plugins/freewins/src/freewins.h 2013-02-20 14:24:30 +0000
+++ plugins/freewins/src/freewins.h 2015-10-22 15:51:58 +0000
@@ -281,8 +281,6 @@
281 int mSnapMask;281 int mSnapMask;
282 int mInvertMask;282 int mInvertMask;
283283
284 Cursor mRotateCursor;
285
286 CompScreen::GrabHandle mGrabIndex;284 CompScreen::GrabHandle mGrabIndex;
287285
288 void preparePaint (int);286 void preparePaint (int);
289287
=== modified file 'plugins/move/src/move.cpp'
--- plugins/move/src/move.cpp 2015-10-22 15:51:57 +0000
+++ plugins/move/src/move.cpp 2015-10-22 15:51:58 +0000
@@ -105,10 +105,12 @@
105105
106 if (!ms->grab)106 if (!ms->grab)
107 {107 {
108 Cursor moveCursor = screen->cursorCache (XC_fleur);
109
108 if (state & CompAction::StateInitButton)110 if (state & CompAction::StateInitButton)
109 ms->grab = s->pushPointerGrab (ms->moveCursor, "move");111 ms->grab = s->pushPointerGrab (moveCursor, "move");
110 else112 else
111 ms->grab = s->pushGrab (ms->moveCursor, "move");113 ms->grab = s->pushGrab (moveCursor, "move");
112 }114 }
113115
114 if (ms->grab)116 if (ms->grab)
@@ -716,7 +718,6 @@
716 key[i] = XKeysymToKeycode (screen->dpy (),718 key[i] = XKeysymToKeycode (screen->dpy (),
717 XStringToKeysym (mKeys[i].name));719 XStringToKeysym (mKeys[i].name));
718720
719 moveCursor = XCreateFontCursor (screen->dpy (), XC_fleur);
720 if (cScreen)721 if (cScreen)
721 {722 {
722 CompositeScreenInterface::setHandler (cScreen);723 CompositeScreenInterface::setHandler (cScreen);
@@ -739,9 +740,6 @@
739{740{
740 if (region)741 if (region)
741 XDestroyRegion (region);742 XDestroyRegion (region);
742
743 if (moveCursor)
744 XFreeCursor (screen->dpy (), moveCursor);
745}743}
746744
747bool745bool
748746
=== modified file 'plugins/move/src/move.h'
--- plugins/move/src/move.h 2013-04-13 21:59:11 +0000
+++ plugins/move/src/move.h 2015-10-22 15:51:58 +0000
@@ -82,8 +82,6 @@
8282
83 CompScreen::GrabHandle grab;83 CompScreen::GrabHandle grab;
8484
85 Cursor moveCursor;
86
87 unsigned int origState;85 unsigned int origState;
8886
89 int snapOffX;87 int snapOffX;
9088
=== modified file 'plugins/resize/src/logic/include/resize-logic.h'
--- plugins/resize/src/logic/include/resize-logic.h 2014-05-28 07:08:10 +0000
+++ plugins/resize/src/logic/include/resize-logic.h 2015-10-22 15:51:58 +0000
@@ -113,20 +113,10 @@
113 int pointerDx;113 int pointerDx;
114 int pointerDy;114 int pointerDy;
115 KeyCode key[NUM_KEYS];115 KeyCode key[NUM_KEYS];
116 unsigned int keyCursorNames[NUM_KEYS];
116117
117 CompScreen::GrabHandle grabIndex;118 CompScreen::GrabHandle grabIndex;
118119
119 Cursor leftCursor;
120 Cursor rightCursor;
121 Cursor upCursor;
122 Cursor upLeftCursor;
123 Cursor upRightCursor;
124 Cursor downCursor;
125 Cursor downLeftCursor;
126 Cursor downRightCursor;
127 Cursor middleCursor;
128 Cursor cursor[NUM_KEYS];
129
130 bool isConstrained;120 bool isConstrained;
131 CompRegion constraintRegion;121 CompRegion constraintRegion;
132 bool inRegionStatus;122 bool inRegionStatus;
133123
=== modified file 'plugins/resize/src/logic/include/screen-interface.h'
--- plugins/resize/src/logic/include/screen-interface.h 2015-10-22 15:51:57 +0000
+++ plugins/resize/src/logic/include/screen-interface.h 2015-10-22 15:51:58 +0000
@@ -59,6 +59,7 @@
59 virtual CompScreen::GrabHandle pushPointerGrab (Cursor cursor, const char *name) = 0;59 virtual CompScreen::GrabHandle pushPointerGrab (Cursor cursor, const char *name) = 0;
60 virtual CompScreen::GrabHandle pushKeyboardGrab (const char *name) = 0;60 virtual CompScreen::GrabHandle pushKeyboardGrab (const char *name) = 0;
61 virtual void removeGrab (CompScreen::GrabHandle handle, CompPoint *restorePointer) = 0;61 virtual void removeGrab (CompScreen::GrabHandle handle, CompPoint *restorePointer) = 0;
62 virtual Cursor cursorCache (unsigned int cursorName) = 0;
6263
63 /* CompOption::Class */64 /* CompOption::Class */
64 virtual CompOption * getOption (const CompString &name) = 0;65 virtual CompOption * getOption (const CompString &name) = 0;
6566
=== modified file 'plugins/resize/src/logic/src/resize-logic.cpp'
--- plugins/resize/src/logic/src/resize-logic.cpp 2015-10-22 15:51:57 +0000
+++ plugins/resize/src/logic/src/resize-logic.cpp 2015-10-22 15:51:58 +0000
@@ -27,6 +27,7 @@
2727
28#include <core/core.h>28#include <core/core.h>
29#include <core/atoms.h>29#include <core/atoms.h>
30#include <X11/cursorfont.h>
3031
31#include "resize-logic.h"32#include "resize-logic.h"
3233
@@ -48,6 +49,16 @@
48static const unsigned short TOUCH_TOP = 3;49static const unsigned short TOUCH_TOP = 3;
49static const unsigned short TOUCH_BOTTOM = 4;50static const unsigned short TOUCH_BOTTOM = 4;
5051
52#define LEFT_CURSOR XC_left_side
53#define RIGHT_CURSOR XC_right_side
54#define UP_CURSOR XC_top_side
55#define UP_LEFT_CURSOR XC_top_left_corner
56#define UP_RIGHT_CURSOR XC_top_right_corner
57#define DOWN_CURSOR XC_bottom_side
58#define DOWN_LEFT_CURSOR XC_bottom_left_corner
59#define DOWN_RIGHT_CURSOR XC_bottom_right_corner
60#define MIDDLE_CURSOR XC_fleur
61
51using namespace resize;62using namespace resize;
5263
53ResizeLogic::ResizeLogic() :64ResizeLogic::ResizeLogic() :
@@ -428,7 +439,7 @@
428 lastMaskY = mask;439 lastMaskY = mask;
429 }440 }
430441
431 mScreen->updateGrab (grabIndex, cursor[i]);442 mScreen->updateGrab (grabIndex, screen->cursorCache (keyCursorNames[i]));
432 }443 }
433 break;444 break;
434 }445 }
@@ -652,36 +663,36 @@
652Cursor663Cursor
653ResizeLogic::cursorFromResizeMask (unsigned int mask)664ResizeLogic::cursorFromResizeMask (unsigned int mask)
654{665{
655 Cursor cursor;666 unsigned int cursor_name;
656667
657 if (mask & ResizeLeftMask)668 if (mask & ResizeLeftMask)
658 {669 {
659 if (mask & ResizeDownMask)670 if (mask & ResizeDownMask)
660 cursor = downLeftCursor;671 cursor_name = DOWN_LEFT_CURSOR;
661 else if (mask & ResizeUpMask)672 else if (mask & ResizeUpMask)
662 cursor = upLeftCursor;673 cursor_name = UP_LEFT_CURSOR;
663 else674 else
664 cursor = leftCursor;675 cursor_name = LEFT_CURSOR;
665 }676 }
666 else if (mask & ResizeRightMask)677 else if (mask & ResizeRightMask)
667 {678 {
668 if (mask & ResizeDownMask)679 if (mask & ResizeDownMask)
669 cursor = downRightCursor;680 cursor_name = DOWN_RIGHT_CURSOR;
670 else if (mask & ResizeUpMask)681 else if (mask & ResizeUpMask)
671 cursor = upRightCursor;682 cursor_name = UP_RIGHT_CURSOR;
672 else683 else
673 cursor = rightCursor;684 cursor_name = RIGHT_CURSOR;
674 }685 }
675 else if (mask & ResizeUpMask)686 else if (mask & ResizeUpMask)
676 {687 {
677 cursor = upCursor;688 cursor_name = UP_CURSOR;
678 }689 }
679 else690 else
680 {691 {
681 cursor = downCursor;692 cursor_name = DOWN_CURSOR;
682 }693 }
683694
684 return cursor;695 return screen->cursorCache (cursor_name);
685}696}
686697
687void698void
@@ -1327,7 +1338,7 @@
1327 Cursor cursor;1338 Cursor cursor;
13281339
1329 if (state & CompAction::StateInitKey)1340 if (state & CompAction::StateInitKey)
1330 cursor = middleCursor;1341 cursor = screen->cursorCache (MIDDLE_CURSOR);
1331 else1342 else
1332 cursor = cursorFromResizeMask (mask);1343 cursor = cursorFromResizeMask (mask);
13331344
13341345
=== modified file 'plugins/resize/src/logic/tests/mock-screen.h'
--- plugins/resize/src/logic/tests/mock-screen.h 2015-10-22 15:51:57 +0000
+++ plugins/resize/src/logic/tests/mock-screen.h 2015-10-22 15:51:58 +0000
@@ -54,6 +54,7 @@
54 MOCK_METHOD2(pushPointerGrab, CompScreen::GrabHandle(Cursor cursor, const char *name));54 MOCK_METHOD2(pushPointerGrab, CompScreen::GrabHandle(Cursor cursor, const char *name));
55 MOCK_METHOD1(pushKeyboardGrab, CompScreen::GrabHandle(const char *name));55 MOCK_METHOD1(pushKeyboardGrab, CompScreen::GrabHandle(const char *name));
56 MOCK_METHOD2(removeGrab, void(CompScreen::GrabHandle handle, CompPoint *restorePointer));56 MOCK_METHOD2(removeGrab, void(CompScreen::GrabHandle handle, CompPoint *restorePointer));
57 MOCK_METHOD1(cursorCache, Cursor (unsigned int));
5758
58 MOCK_METHOD1(getOption, CompOption*(const CompString &name));59 MOCK_METHOD1(getOption, CompOption*(const CompString &name));
5960
6061
=== modified file 'plugins/resize/src/resize.cpp'
--- plugins/resize/src/resize.cpp 2013-05-15 10:23:30 +0000
+++ plugins/resize/src/resize.cpp 2015-10-22 15:51:58 +0000
@@ -380,7 +380,6 @@
380 logic.options = this;380 logic.options = this;
381381
382 CompOption::Vector atomTemplate;382 CompOption::Vector atomTemplate;
383 Display *dpy = s->dpy ();
384 ResizeOptions::ChangeNotify notify =383 ResizeOptions::ChangeNotify notify =
385 boost::bind (&ResizeScreen::optionChanged, this, _1, _2);384 boost::bind (&ResizeScreen::optionChanged, this, _1, _2);
386385
@@ -404,21 +403,6 @@
404 for (unsigned int i = 0; i < NUM_KEYS; i++)403 for (unsigned int i = 0; i < NUM_KEYS; i++)
405 logic.key[i] = XKeysymToKeycode (s->dpy (), XStringToKeysym (logic.rKeys[i].name));404 logic.key[i] = XKeysymToKeycode (s->dpy (), XStringToKeysym (logic.rKeys[i].name));
406405
407 logic.leftCursor = XCreateFontCursor (dpy, XC_left_side);
408 logic.rightCursor = XCreateFontCursor (dpy, XC_right_side);
409 logic.upCursor = XCreateFontCursor (dpy, XC_top_side);
410 logic.upLeftCursor = XCreateFontCursor (dpy, XC_top_left_corner);
411 logic.upRightCursor = XCreateFontCursor (dpy, XC_top_right_corner);
412 logic.downCursor = XCreateFontCursor (dpy, XC_bottom_side);
413 logic.downLeftCursor = XCreateFontCursor (dpy, XC_bottom_left_corner);
414 logic.downRightCursor = XCreateFontCursor (dpy, XC_bottom_right_corner);
415 logic.middleCursor = XCreateFontCursor (dpy, XC_fleur);
416
417 logic.cursor[0] = logic.leftCursor;
418 logic.cursor[1] = logic.rightCursor;
419 logic.cursor[2] = logic.upCursor;
420 logic.cursor[3] = logic.downCursor;
421
422 optionSetInitiateKeyInitiate (resizeInitiateDefaultMode);406 optionSetInitiateKeyInitiate (resizeInitiateDefaultMode);
423 optionSetInitiateKeyTerminate (resizeTerminate);407 optionSetInitiateKeyTerminate (resizeTerminate);
424 optionSetInitiateButtonInitiate (resizeInitiateDefaultMode);408 optionSetInitiateButtonInitiate (resizeInitiateDefaultMode);
@@ -442,27 +426,6 @@
442426
443ResizeScreen::~ResizeScreen ()427ResizeScreen::~ResizeScreen ()
444{428{
445 Display *dpy = screen->dpy ();
446
447 if (logic.leftCursor)
448 XFreeCursor (dpy, logic.leftCursor);
449 if (logic.rightCursor)
450 XFreeCursor (dpy, logic.rightCursor);
451 if (logic.upCursor)
452 XFreeCursor (dpy, logic.upCursor);
453 if (logic.downCursor)
454 XFreeCursor (dpy, logic.downCursor);
455 if (logic.middleCursor)
456 XFreeCursor (dpy, logic.middleCursor);
457 if (logic.upLeftCursor)
458 XFreeCursor (dpy, logic.upLeftCursor);
459 if (logic.upRightCursor)
460 XFreeCursor (dpy, logic.upRightCursor);
461 if (logic.downLeftCursor)
462 XFreeCursor (dpy, logic.downLeftCursor);
463 if (logic.downRightCursor)
464 XFreeCursor (dpy, logic.downRightCursor);
465
466 delete logic.mScreen;429 delete logic.mScreen;
467 delete logic.cScreen;430 delete logic.cScreen;
468 delete logic.gScreen;431 delete logic.gScreen;
469432
=== modified file 'plugins/resize/src/screen-impl.h'
--- plugins/resize/src/screen-impl.h 2015-10-22 15:51:57 +0000
+++ plugins/resize/src/screen-impl.h 2015-10-22 15:51:58 +0000
@@ -134,6 +134,11 @@
134 return mImpl->height ();134 return mImpl->height ();
135 }135 }
136136
137 virtual Cursor cursorCache (unsigned int cursorName)
138 {
139 return mImpl->cursorCache (cursorName);
140 }
141
137 private:142 private:
138 CompScreen *mImpl;143 CompScreen *mImpl;
139};144};
140145
=== modified file 'plugins/shelf/src/shelf.cpp'
--- plugins/shelf/src/shelf.cpp 2013-05-09 13:43:07 +0000
+++ plugins/shelf/src/shelf.cpp 2015-10-22 15:51:58 +0000
@@ -509,7 +509,7 @@
509 {509 {
510 window->activate ();510 window->activate ();
511 ss->grabbedWindow = window->id ();511 ss->grabbedWindow = window->id ();
512 ss->grabIndex = screen->pushGrab (ss->moveCursor, "shelf");512 ss->grabIndex = screen->pushGrab (screen->cursorCache (XC_fleur), "shelf");
513513
514 ss->lastPointerX = x;514 ss->lastPointerX = x;
515 ss->lastPointerY = y;515 ss->lastPointerY = y;
@@ -760,7 +760,6 @@
760 gScreen (GLScreen::get (screen)),760 gScreen (GLScreen::get (screen)),
761 grabIndex (0),761 grabIndex (0),
762 grabbedWindow (None),762 grabbedWindow (None),
763 moveCursor (XCreateFontCursor (screen->dpy (), XC_fleur)),
764 lastPointerX (0),763 lastPointerX (0),
765 lastPointerY (0)764 lastPointerY (0)
766{765{
@@ -780,11 +779,6 @@
780 _3));779 _3));
781}780}
782781
783ShelfScreen::~ShelfScreen ()
784{
785 if (moveCursor)
786 XFreeCursor (screen->dpy (), moveCursor);
787}
788782
789ShelfWindow::ShelfWindow (CompWindow *window) :783ShelfWindow::ShelfWindow (CompWindow *window) :
790 PluginClassHandler <ShelfWindow, CompWindow> (window),784 PluginClassHandler <ShelfWindow, CompWindow> (window),
791785
=== modified file 'plugins/shelf/src/shelf.h'
--- plugins/shelf/src/shelf.h 2012-09-07 23:29:42 +0000
+++ plugins/shelf/src/shelf.h 2015-10-22 15:51:58 +0000
@@ -145,7 +145,6 @@
145 public:145 public:
146146
147 ShelfScreen (CompScreen *);147 ShelfScreen (CompScreen *);
148 ~ShelfScreen ();
149148
150 CompositeScreen *cScreen;149 CompositeScreen *cScreen;
151 GLScreen *gScreen;150 GLScreen *gScreen;
152151
=== modified file 'plugins/shift/src/shift.cpp'
--- plugins/shift/src/shift.cpp 2013-05-11 09:30:49 +0000
+++ plugins/shift/src/shift.cpp 2015-10-22 15:51:58 +0000
@@ -1968,7 +1968,6 @@
1968 mMvTarget (0),1968 mMvTarget (0),
1969 mMvVelocity (0),1969 mMvVelocity (0),
1970 mInvert (false),1970 mInvert (false),
1971 mCursor (XCreateFontCursor (screen->dpy (), XC_left_ptr)),
1972 mWindows (NULL),1971 mWindows (NULL),
1973 mNWindows (0),1972 mNWindows (0),
1974 mWindowsSize (0),1973 mWindowsSize (0),
@@ -2059,8 +2058,6 @@
2059{2058{
2060 freeWindowTitle ();2059 freeWindowTitle ();
20612060
2062 XFreeCursor (screen->dpy (), mCursor);
2063
2064 if (mWindows)2061 if (mWindows)
2065 free (mWindows);2062 free (mWindows);
20662063
20672064
=== modified file 'plugins/shift/src/shift.h'
--- plugins/shift/src/shift.h 2013-04-27 16:51:53 +0000
+++ plugins/shift/src/shift.h 2015-10-22 15:51:58 +0000
@@ -143,8 +143,6 @@
143 float mMvVelocity;143 float mMvVelocity;
144 bool mInvert;144 bool mInvert;
145 145
146 Cursor mCursor;
147
148 /* only used for sorting */146 /* only used for sorting */
149 CompWindow **mWindows;147 CompWindow **mWindows;
150 int mNWindows;148 int mNWindows;
151149
=== modified file 'plugins/widget/src/widget.cpp'
--- plugins/widget/src/widget.cpp 2013-05-28 21:31:18 +0000
+++ plugins/widget/src/widget.cpp 2015-10-22 15:51:58 +0000
@@ -312,7 +312,7 @@
312 }312 }
313313
314 if (!mGrabIndex)314 if (!mGrabIndex)
315 mGrabIndex = screen->pushGrab (mCursor, "widget");315 mGrabIndex = screen->pushGrab (screen->cursorCache (XC_watch), "widget");
316316
317 enableFunctions (this, true);317 enableFunctions (this, true);
318318
@@ -672,8 +672,7 @@
672 mLastActiveWindow (None),672 mLastActiveWindow (None),
673 mCompizWidgetAtom (XInternAtom (screen->dpy (), "_COMPIZ_WIDGET", false)),673 mCompizWidgetAtom (XInternAtom (screen->dpy (), "_COMPIZ_WIDGET", false)),
674 mFadeTime (0),674 mFadeTime (0),
675 mGrabIndex (0),675 mGrabIndex (0)
676 mCursor (XCreateFontCursor (screen->dpy (), XC_watch))
677{676{
678 CompAction::CallBack cb;677 CompAction::CallBack cb;
679 ChangeNotify notify;678 ChangeNotify notify;
@@ -706,9 +705,6 @@
706{705{
707 screen->matchExpHandlerChangedSetEnabled (this, false);706 screen->matchExpHandlerChangedSetEnabled (this, false);
708 screen->matchExpHandlerChanged ();707 screen->matchExpHandlerChanged ();
709
710 if (mCursor)
711 XFreeCursor (screen->dpy (), mCursor);
712}708}
713709
714WidgetWindow::WidgetWindow (CompWindow *window) :710WidgetWindow::WidgetWindow (CompWindow *window) :
715711
=== modified file 'plugins/widget/src/widget.h'
--- plugins/widget/src/widget.h 2013-05-28 21:31:18 +0000
+++ plugins/widget/src/widget.h 2015-10-22 15:51:58 +0000
@@ -107,7 +107,6 @@
107 WidgetState mState;107 WidgetState mState;
108 int mFadeTime;108 int mFadeTime;
109 CompScreen::GrabHandle mGrabIndex;109 CompScreen::GrabHandle mGrabIndex;
110 Cursor mCursor;
111};110};
112111
113#define WIDGET_SCREEN(screen) \112#define WIDGET_SCREEN(screen) \
114113
=== modified file 'src/privatescreen.h'
--- src/privatescreen.h 2015-10-22 15:51:57 +0000
+++ src/privatescreen.h 2015-10-22 15:51:58 +0000
@@ -710,6 +710,10 @@
710710
711 void setDefaultWindowAttributes (XWindowAttributes *);711 void setDefaultWindowAttributes (XWindowAttributes *);
712712
713 void updateCursors (const CompString& theme, int size);
714
715 Cursor cursorCache (unsigned int cursorName);
716
713 static void compScreenSnEvent (SnMonitorEvent *event,717 static void compScreenSnEvent (SnMonitorEvent *event,
714 void *userData);718 void *userData);
715719
@@ -777,9 +781,8 @@
777 Window wmSnSelectionWindow;781 Window wmSnSelectionWindow;
778782
779 int clientPointerDeviceId;783 int clientPointerDeviceId;
780 Cursor normalCursor;
781 Cursor busyCursor;
782 Cursor invisibleCursor;784 Cursor invisibleCursor;
785 std::vector<Cursor> cursors;
783 CompRect workArea;786 CompRect workArea;
784787
785 bool initialized;788 bool initialized;
@@ -969,8 +972,8 @@
969 void unhookServerWindow (CompWindow *w);972 void unhookServerWindow (CompWindow *w);
970973
971 Cursor normalCursor ();974 Cursor normalCursor ();
972
973 Cursor invisibleCursor ();975 Cursor invisibleCursor ();
976 Cursor cursorCache (unsigned int cursorName);
974977
975 /* Adds an X Pointer and Keyboard grab to the stack. Since978 /* Adds an X Pointer and Keyboard grab to the stack. Since
976 * compiz as a client only need to grab once, multiple clients979 * compiz as a client only need to grab once, multiple clients
977980
=== modified file 'src/privatescreen/tests/test-privatescreen.cpp'
--- src/privatescreen/tests/test-privatescreen.cpp 2015-10-22 15:51:57 +0000
+++ src/privatescreen/tests/test-privatescreen.cpp 2015-10-22 15:51:58 +0000
@@ -178,6 +178,7 @@
178 MOCK_METHOD0(displayString, const char * ());178 MOCK_METHOD0(displayString, const char * ());
179 MOCK_METHOD0(getCurrentOutputExtents, CompRect ());179 MOCK_METHOD0(getCurrentOutputExtents, CompRect ());
180 MOCK_METHOD0(normalCursor, Cursor ());180 MOCK_METHOD0(normalCursor, Cursor ());
181 MOCK_METHOD1(cursorCache, Cursor (unsigned int));
181 MOCK_METHOD0(grabbed, bool ());182 MOCK_METHOD0(grabbed, bool ());
182 MOCK_METHOD0(snDisplay, SnDisplay * ());183 MOCK_METHOD0(snDisplay, SnDisplay * ());
183 MOCK_CONST_METHOD0(createFailed, bool ());184 MOCK_CONST_METHOD0(createFailed, bool ());
184185
=== modified file 'src/screen.cpp'
--- src/screen.cpp 2015-10-22 15:51:57 +0000
+++ src/screen.cpp 2015-10-22 15:51:58 +0000
@@ -54,6 +54,7 @@
54#include <X11/extensions/shape.h>54#include <X11/extensions/shape.h>
55#include <X11/cursorfont.h>55#include <X11/cursorfont.h>
56#include <X11/extensions/XInput2.h>56#include <X11/extensions/XInput2.h>
57#include <X11/Xcursor/Xcursor.h>
5758
58#include <core/global.h>59#include <core/global.h>
59#include <core/screen.h>60#include <core/screen.h>
@@ -78,10 +79,12 @@
78namespace79namespace
79{80{
80bool inHandleEvent = false;81bool inHandleEvent = false;
81
82bool screenInitalized = false;82bool screenInitalized = false;
83}83}
8484
85#define normalCursorName XC_left_ptr
86#define busyCursorName XC_watch
87
85#define MwmHintsFunctions (1L << 0)88#define MwmHintsFunctions (1L << 0)
86#define MwmHintsDecorations (1L << 1)89#define MwmHintsDecorations (1L << 1)
87static const unsigned short PropMotifWmHintElements = 3;90static const unsigned short PropMotifWmHintElements = 3;
@@ -2149,9 +2152,9 @@
2149 if (priv->initialized)2152 if (priv->initialized)
2150 {2153 {
2151 if (!emptySequence())2154 if (!emptySequence())
2152 XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->busyCursor);2155 XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->cursorCache (busyCursorName));
2153 else2156 else
2154 XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->normalCursor);2157 XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->cursorCache (normalCursorName));
2155 }2158 }
2156}2159}
21572160
@@ -3083,7 +3086,7 @@
3083Cursor3086Cursor
3084CompScreenImpl::normalCursor ()3087CompScreenImpl::normalCursor ()
3085{3088{
3086 return privateScreen.normalCursor;3089 return privateScreen.cursorCache (normalCursorName);
3087}3090}
30883091
3089Cursor3092Cursor
@@ -3092,6 +3095,12 @@
3092 return privateScreen.invisibleCursor;3095 return privateScreen.invisibleCursor;
3093}3096}
30943097
3098Cursor
3099CompScreenImpl::cursorCache (unsigned int cursorName)
3100{
3101 return privateScreen.cursorCache (cursorName);
3102}
3103
3095#define POINTER_GRAB_MASK (ButtonReleaseMask | \3104#define POINTER_GRAB_MASK (ButtonReleaseMask | \
3096 ButtonPressMask | \3105 ButtonPressMask | \
3097 PointerMotionMask)3106 PointerMotionMask)
@@ -4153,8 +4162,47 @@
4153 _cursorChangeNotify (theme, size);4162 _cursorChangeNotify (theme, size);
4154}4163}
41554164
4156void CompScreenImpl::_cursorChangeNotify (const CompString&, int)4165Cursor
4157{4166PrivateScreen::cursorCache (unsigned int cursorName)
4167{
4168 if (cursorName >= XC_num_glyphs)
4169 return 0;
4170
4171 if (cursors.size() > cursorName && cursors[cursorName])
4172 return cursors[cursorName];
4173
4174 cursors.resize(std::max<size_t>(cursorName + 1, cursors.size()), 0);
4175 cursors[cursorName] = XCreateFontCursor (dpy, cursorName);
4176
4177 return cursors[cursorName];
4178}
4179
4180void
4181PrivateScreen::updateCursors (const CompString& theme, int size)
4182{
4183 if (size > 0)
4184 XcursorSetDefaultSize (dpy, size);
4185
4186 if (!theme.empty())
4187 XcursorSetTheme (dpy, theme.c_str());
4188
4189 for (auto it = begin (cursors); it != end (cursors); ++it)
4190 {
4191 if (*it)
4192 {
4193 XFreeCursor (dpy, *it);
4194 *it = XCreateFontCursor (dpy, it - begin (cursors));
4195 }
4196 }
4197
4198 XIDefineCursor (dpy, clientPointerDeviceId, root, cursorCache (normalCursorName));
4199 startupSequence.updateStartupFeedback ();
4200}
4201
4202void
4203CompScreenImpl::_cursorChangeNotify (const CompString& theme, int size)
4204{
4205 privateScreen.updateCursors (theme, size);
4158}4206}
41594207
4160/* Returns default viewport for some window geometry. If the window spans4208/* Returns default viewport for some window geometry. If the window spans
@@ -5154,15 +5202,10 @@
5154 eventManager.setSupportingWmCheck (dpy, rootWindow());5202 eventManager.setSupportingWmCheck (dpy, rootWindow());
5155 screen->updateSupportedWmHints ();5203 screen->updateSupportedWmHints ();
51565204
5205
5206 XIGetClientPointer (dpy, None, &clientPointerDeviceId);
5157 updateResources ();5207 updateResources ();
51585208
5159 XIGetClientPointer (dpy, None, &clientPointerDeviceId);
5160
5161 normalCursor = XCreateFontCursor (dpy, XC_left_ptr);
5162 busyCursor = XCreateFontCursor (dpy, XC_watch);
5163
5164 XIDefineCursor (dpy, clientPointerDeviceId, rootWindow(), normalCursor);
5165
5166 /* Attempt to gain SubstructureRedirectMask */5209 /* Attempt to gain SubstructureRedirectMask */
5167 CompScreenImpl::checkForError (dpy);5210 CompScreenImpl::checkForError (dpy);
51685211
@@ -5337,8 +5380,6 @@
5337 currentDesktop (0),5380 currentDesktop (0),
5338 wmSnSelectionWindow (None),5381 wmSnSelectionWindow (None),
5339 clientPointerDeviceId (None),5382 clientPointerDeviceId (None),
5340 normalCursor (None),
5341 busyCursor (None),
5342 invisibleCursor (None),5383 invisibleCursor (None),
5343 initialized (false),5384 initialized (false),
5344 screen(screen),5385 screen(screen),
@@ -5459,11 +5500,8 @@
54595500
5460 eventManager.destroyGrabWindow (dpy);5501 eventManager.destroyGrabWindow (dpy);
54615502
5462 if (normalCursor != None)5503 for (auto cursor : cursors)
5463 XFreeCursor (dpy, normalCursor);5504 XFreeCursor (dpy, cursor);
5464
5465 if (busyCursor != None)
5466 XFreeCursor (dpy, busyCursor);
54675505
5468 if (invisibleCursor != None)5506 if (invisibleCursor != None)
5469 XFreeCursor (dpy, invisibleCursor);5507 XFreeCursor (dpy, invisibleCursor);

Subscribers

People subscribed via source and target branches