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

Proposed by Marco Trevisan (Treviño)
Status: Superseded
Proposed branch: lp:~3v1n0/compiz/cursors-update-on-theme+size-changes
Merge into: lp:compiz/0.9.12
Prerequisite: lp:~3v1n0/compiz/resize-selective-grab
Diff against target: 1027 lines (+223/-166)
27 files modified
CMakeLists.txt (+1/-0)
debian/patches/ubuntu_super_p.patch.OTHER (+0/-27)
include/core/abiversion.h (+1/-1)
include/core/screen.h (+6/-1)
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/event.cpp (+5/-0)
src/privatescreen.h (+10/-3)
src/privatescreen/tests/test-privatescreen.cpp (+2/-0)
src/screen.cpp (+156/-24)
To merge this branch: bzr merge lp:~3v1n0/compiz/cursors-update-on-theme+size-changes
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Andrea Azzarone Approve
Review via email: mp+275057@code.launchpad.net

This proposal has been superseded by a proposal from 2015-10-22.

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 :
review: Needs Fixing (continuous-integration)
Revision history for this message
Andrea Azzarone (azzar1) wrote :

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

Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve
3953. By Marco Trevisan (Treviño)

Resize: add cursorCache definition to screen-interface

3954. By Marco Trevisan (Treviño)

CompScreen: add missing declaration for cursorCache method

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: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
3955. By Marco Trevisan (Treviño)

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

Unmerged revisions

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-20 22:44:20 +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
=== removed directory 'debian/patches'
=== removed file 'debian/patches/ubuntu_super_p.patch.OTHER'
--- debian/patches/ubuntu_super_p.patch.OTHER 2015-10-20 22:44:20 +0000
+++ debian/patches/ubuntu_super_p.patch.OTHER 1970-01-01 00:00:00 +0000
@@ -1,27 +0,0 @@
1Index: compiz/src/screen.cpp
2===================================================================
3--- compiz.orig/src/screen.cpp 2015-09-18 04:41:44.071761222 +0200
4+++ compiz/src/screen.cpp 2015-09-18 04:47:21.284758934 +0200
5@@ -3294,10 +3294,19 @@
6 * This is so that we can detect taps on individual modifier
7 * keys, and know to cancel the tap if <modifier>+k is pressed.
8 */
9- if (!(currentState & CompAction::StateIgnoreTap))
10+ int minCode, maxCode;
11+ XDisplayKeycodes (screen->dpy(), &minCode, &maxCode);
12+
13+ if ((currentState & CompAction::StateIgnoreTap))
14+ {
15+ KeyCode code_p = XKeysymToKeycode(screen->dpy(), XK_p);
16+
17+ for (k = minCode; k <= maxCode; k++)
18+ if (k != code_p)
19+ grabUngrabOneKey (modifiers | ignore, k, grab);
20+ }
21+ else
22 {
23- int minCode, maxCode;
24- XDisplayKeycodes (screen->dpy(), &minCode, &maxCode);
25 for (k = minCode; k <= maxCode; k++)
26 grabUngrabOneKey (modifiers | modifierForKeycode | ignore, k, grab);
27 }
280
=== modified file 'include/core/abiversion.h'
--- include/core/abiversion.h 2015-10-20 22:44:20 +0000
+++ include/core/abiversion.h 2015-10-20 22:44:20 +0000
@@ -5,6 +5,6 @@
5# error Conflicting definitions of CORE_ABIVERSION5# error Conflicting definitions of CORE_ABIVERSION
6#endif6#endif
77
8#define CORE_ABIVERSION 201509188#define CORE_ABIVERSION 20151010
99
10#endif // COMPIZ_ABIVERSION_H10#endif // COMPIZ_ABIVERSION_H
1111
=== modified file 'include/core/screen.h'
--- include/core/screen.h 2015-10-20 22:44:20 +0000
+++ include/core/screen.h 2015-10-20 22:44:20 +0000
@@ -155,6 +155,7 @@
155 virtual void outputChangeNotify ();155 virtual void outputChangeNotify ();
156 virtual void addSupportedAtoms (std::vector<Atom>& atoms);156 virtual void addSupportedAtoms (std::vector<Atom>& atoms);
157157
158 virtual void cursorChangeNotify (const CompString& theme, int size);
158};159};
159160
160namespace compiz { namespace private_screen {161namespace compiz { namespace private_screen {
@@ -217,7 +218,7 @@
217}218}
218219
219class CompScreen :220class CompScreen :
220 public WrapableHandler<ScreenInterface, 18>,221 public WrapableHandler<ScreenInterface, 19>,
221 public PluginClassStorage, // TODO should be an interface here222 public PluginClassStorage, // TODO should be an interface here
222 public CompSize,223 public CompSize,
223 public virtual ::compiz::DesktopWindowCount,224 public virtual ::compiz::DesktopWindowCount,
@@ -267,6 +268,8 @@
267 WRAPABLE_HND (16, ScreenInterface, void, outputChangeNotify);268 WRAPABLE_HND (16, ScreenInterface, void, outputChangeNotify);
268 WRAPABLE_HND (17, ScreenInterface, void, addSupportedAtoms,269 WRAPABLE_HND (17, ScreenInterface, void, addSupportedAtoms,
269 std::vector<Atom>& atoms);270 std::vector<Atom>& atoms);
271 WRAPABLE_HND (18, ScreenInterface, void, cursorChangeNotify,
272 const CompString&, int);
270273
271 unsigned int allocPluginClassIndex ();274 unsigned int allocPluginClassIndex ();
272 void freePluginClassIndex (unsigned int index);275 void freePluginClassIndex (unsigned int index);
@@ -392,6 +395,7 @@
392 virtual const char * displayString () = 0;395 virtual const char * displayString () = 0;
393 virtual CompRect getCurrentOutputExtents () = 0;396 virtual CompRect getCurrentOutputExtents () = 0;
394 virtual Cursor normalCursor () = 0;397 virtual Cursor normalCursor () = 0;
398 virtual Cursor cursorCache (unsigned int cursorName) = 0;
395 virtual bool grabbed () = 0;399 virtual bool grabbed () = 0;
396 virtual SnDisplay * snDisplay () = 0;400 virtual SnDisplay * snDisplay () = 0;
397401
@@ -445,6 +449,7 @@
445 virtual void _matchExpHandlerChanged() = 0;449 virtual void _matchExpHandlerChanged() = 0;
446 virtual void _matchPropertyChanged(CompWindow *) = 0;450 virtual void _matchPropertyChanged(CompWindow *) = 0;
447 virtual void _outputChangeNotify() = 0;451 virtual void _outputChangeNotify() = 0;
452 virtual void _cursorChangeNotify(const CompString&, int) = 0;
448};453};
449454
450#endif455#endif
451456
=== 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-20 22:44:20 +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-20 22:44:20 +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-20 22:44:20 +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-20 22:44:20 +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-20 22:44:20 +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-20 22:44:20 +0000
+++ plugins/move/src/move.cpp 2015-10-20 22:44:20 +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-20 22:44:20 +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-20 22:44:20 +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-20 22:44:20 +0000
+++ plugins/resize/src/logic/include/screen-interface.h 2015-10-20 22:44:20 +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-20 22:44:20 +0000
+++ plugins/resize/src/logic/src/resize-logic.cpp 2015-10-20 22:44:20 +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-20 22:44:20 +0000
+++ plugins/resize/src/logic/tests/mock-screen.h 2015-10-20 22:44:20 +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-20 22:44:20 +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-20 22:44:20 +0000
+++ plugins/resize/src/screen-impl.h 2015-10-20 22:44:20 +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-20 22:44:20 +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-20 22:44:20 +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-20 22:44:20 +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-20 22:44:20 +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-20 22:44:20 +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-20 22:44:20 +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/event.cpp'
--- src/event.cpp 2015-08-05 11:26:30 +0000
+++ src/event.cpp 2015-10-20 22:44:20 +0000
@@ -1801,6 +1801,11 @@
1801 if (w)1801 if (w)
1802 w->priv->updateClassHints ();1802 w->priv->updateClassHints ();
1803 }1803 }
1804 else if (event->xproperty.atom == XA_RESOURCE_MANAGER)
1805 {
1806 if (event->xproperty.window == privateScreen.rootWindow())
1807 privateScreen.updateResources();
1808 }
1804 break;1809 break;
1805 case MotionNotify:1810 case MotionNotify:
1806 break;1811 break;
18071812
=== modified file 'src/privatescreen.h'
--- src/privatescreen.h 2015-10-20 22:44:20 +0000
+++ src/privatescreen.h 2015-10-20 22:44:20 +0000
@@ -688,6 +688,8 @@
688688
689 void updateScreenInfo ();689 void updateScreenInfo ();
690690
691 void updateResources ();
692
691 Window getActiveWindow (Window root);693 Window getActiveWindow (Window root);
692694
693 void setWindowState (unsigned int state, Window id);695 void setWindowState (unsigned int state, Window id);
@@ -708,6 +710,10 @@
708710
709 void setDefaultWindowAttributes (XWindowAttributes *);711 void setDefaultWindowAttributes (XWindowAttributes *);
710712
713 void updateCursors (const CompString& theme, int size);
714
715 Cursor cursorCache (unsigned int cursorName);
716
711 static void compScreenSnEvent (SnMonitorEvent *event,717 static void compScreenSnEvent (SnMonitorEvent *event,
712 void *userData);718 void *userData);
713719
@@ -775,9 +781,8 @@
775 Window wmSnSelectionWindow;781 Window wmSnSelectionWindow;
776782
777 int clientPointerDeviceId;783 int clientPointerDeviceId;
778 Cursor normalCursor;
779 Cursor busyCursor;
780 Cursor invisibleCursor;784 Cursor invisibleCursor;
785 std::vector<Cursor> cursors;
781 CompRect workArea;786 CompRect workArea;
782787
783 bool initialized;788 bool initialized;
@@ -814,6 +819,7 @@
814 Window xdndWindow;819 Window xdndWindow;
815 compiz::private_screen::PluginManager pluginManager;820 compiz::private_screen::PluginManager pluginManager;
816 compiz::private_screen::WindowManager& windowManager;821 compiz::private_screen::WindowManager& windowManager;
822 CompOption::Vector resourceManager;
817};823};
818824
819class CompManager825class CompManager
@@ -966,8 +972,8 @@
966 void unhookServerWindow (CompWindow *w);972 void unhookServerWindow (CompWindow *w);
967973
968 Cursor normalCursor ();974 Cursor normalCursor ();
969
970 Cursor invisibleCursor ();975 Cursor invisibleCursor ();
976 Cursor cursorCache (unsigned int cursorName);
971977
972 /* Adds an X Pointer and Keyboard grab to the stack. Since978 /* Adds an X Pointer and Keyboard grab to the stack. Since
973 * compiz as a client only need to grab once, multiple clients979 * compiz as a client only need to grab once, multiple clients
@@ -1176,6 +1182,7 @@
1176 virtual void _matchExpHandlerChanged();1182 virtual void _matchExpHandlerChanged();
1177 virtual void _matchPropertyChanged(CompWindow *);1183 virtual void _matchPropertyChanged(CompWindow *);
1178 virtual void _outputChangeNotify();1184 virtual void _outputChangeNotify();
1185 virtual void _cursorChangeNotify(const CompString&, int);
11791186
1180 void grabServer ();1187 void grabServer ();
1181 void ungrabServer ();1188 void ungrabServer ();
11821189
=== modified file 'src/privatescreen/tests/test-privatescreen.cpp'
--- src/privatescreen/tests/test-privatescreen.cpp 2015-10-20 22:44:20 +0000
+++ src/privatescreen/tests/test-privatescreen.cpp 2015-10-20 22:44:20 +0000
@@ -81,6 +81,7 @@
81 MOCK_METHOD0(_matchExpHandlerChanged, void ());81 MOCK_METHOD0(_matchExpHandlerChanged, void ());
82 MOCK_METHOD1(_matchPropertyChanged, void (CompWindow *));82 MOCK_METHOD1(_matchPropertyChanged, void (CompWindow *));
83 MOCK_METHOD0(_outputChangeNotify, void ());83 MOCK_METHOD0(_outputChangeNotify, void ());
84 MOCK_METHOD2(_cursorChangeNotify, void (const CompString&, int));
8485
85 MOCK_METHOD0(outputDevs, CompOutput::vector & ());86 MOCK_METHOD0(outputDevs, CompOutput::vector & ());
86 MOCK_METHOD2(setWindowState, void (unsigned int state, Window id));87 MOCK_METHOD2(setWindowState, void (unsigned int state, Window id));
@@ -177,6 +178,7 @@
177 MOCK_METHOD0(displayString, const char * ());178 MOCK_METHOD0(displayString, const char * ());
178 MOCK_METHOD0(getCurrentOutputExtents, CompRect ());179 MOCK_METHOD0(getCurrentOutputExtents, CompRect ());
179 MOCK_METHOD0(normalCursor, Cursor ());180 MOCK_METHOD0(normalCursor, Cursor ());
181 MOCK_METHOD1(cursorCache, Cursor (unsigned int));
180 MOCK_METHOD0(grabbed, bool ());182 MOCK_METHOD0(grabbed, bool ());
181 MOCK_METHOD0(snDisplay, SnDisplay * ());183 MOCK_METHOD0(snDisplay, SnDisplay * ());
182 MOCK_CONST_METHOD0(createFailed, bool ());184 MOCK_CONST_METHOD0(createFailed, bool ());
183185
=== modified file 'src/screen.cpp'
--- src/screen.cpp 2015-10-20 22:44:20 +0000
+++ src/screen.cpp 2015-10-20 22:44:20 +0000
@@ -44,6 +44,7 @@
4444
45#include <boost/bind.hpp>45#include <boost/bind.hpp>
46#include <boost/foreach.hpp>46#include <boost/foreach.hpp>
47#include <boost/algorithm/string.hpp>
47#define foreach BOOST_FOREACH48#define foreach BOOST_FOREACH
4849
49#include <X11/Xlib.h>50#include <X11/Xlib.h>
@@ -53,6 +54,7 @@
53#include <X11/extensions/shape.h>54#include <X11/extensions/shape.h>
54#include <X11/cursorfont.h>55#include <X11/cursorfont.h>
55#include <X11/extensions/XInput2.h>56#include <X11/extensions/XInput2.h>
57#include <X11/Xcursor/Xcursor.h>
5658
57#include <core/global.h>59#include <core/global.h>
58#include <core/screen.h>60#include <core/screen.h>
@@ -77,10 +79,12 @@
77namespace79namespace
78{80{
79bool inHandleEvent = false;81bool inHandleEvent = false;
80
81bool screenInitalized = false;82bool screenInitalized = false;
82}83}
8384
85#define normalCursorName XC_left_ptr
86#define busyCursorName XC_watch
87
84#define MwmHintsFunctions (1L << 0)88#define MwmHintsFunctions (1L << 0)
85#define MwmHintsDecorations (1L << 1)89#define MwmHintsDecorations (1L << 1)
86static const unsigned short PropMotifWmHintElements = 3;90static const unsigned short PropMotifWmHintElements = 3;
@@ -101,6 +105,14 @@
101105
102PluginClassStorage::Indices screenPluginClassIndices (0);106PluginClassStorage::Indices screenPluginClassIndices (0);
103107
108namespace utils
109{
110bool is_number (CompString const& s)
111{
112 return std::find_if (s.begin (), s.end (), [](char c) { return !std::isdigit (c); }) == s.end ();
113}
114}
115
104void CompScreenImpl::sizePluginClasses(unsigned int size)116void CompScreenImpl::sizePluginClasses(unsigned int size)
105{117{
106 if(size != pluginClasses.size ())118 if(size != pluginClasses.size ())
@@ -1271,8 +1283,8 @@
1271 eventManager.quit ();1283 eventManager.quit ();
1272}1284}
12731285
1274static const std::string IMAGEDIR("images");1286static const CompString IMAGEDIR("images");
1275static const std::string HOMECOMPIZDIR(".compiz-1");1287static const CompString HOMECOMPIZDIR(".compiz-1");
12761288
1277bool1289bool
1278CompScreenImpl::readImageFromFile (CompString &name,1290CompScreenImpl::readImageFromFile (CompString &name,
@@ -1353,6 +1365,68 @@
1353 return w;1365 return w;
1354}1366}
13551367
1368void
1369PrivateScreen::updateResources ()
1370{
1371 Atom actual;
1372 int result, format;
1373 unsigned long n, left;
1374 unsigned char *data;
1375
1376 result = XGetWindowProperty (dpy, root,
1377 XA_RESOURCE_MANAGER, 0L, 65536, False,
1378 XA_STRING, &actual, &format,
1379 &n, &left, &data);
1380
1381 int oldCursorSize = CompOption::getIntOptionNamed (resourceManager, "Xcursor.size", -1);
1382 CompString oldCursorTheme = CompOption::getStringOptionNamed (resourceManager, "Xcursor.theme");
1383 resourceManager.clear ();
1384
1385 if (result == Success && data)
1386 {
1387 if (actual == XA_STRING)
1388 {
1389 std::vector<CompString> lines;
1390 CompString resources (reinterpret_cast<char *> (data));
1391 boost::split (lines, resources, boost::is_any_of ("\n"));
1392
1393 for (auto const& line : lines)
1394 {
1395 std::vector<CompString> pair;
1396 boost::split (pair, line, boost::is_any_of ("\t"));
1397
1398 if (pair.size () == 2 && pair[0].back () == ':')
1399 {
1400 CompOption option;
1401 auto key = pair[0].substr (0, pair[0].size () - 1);
1402 auto const& value = pair[1];
1403
1404 if (utils::is_number (value))
1405 {
1406 option.setName (key, CompOption::TypeInt);
1407 option.value ().set (std::atoi (value.c_str ()));
1408 }
1409 else
1410 {
1411 option.setName (key, CompOption::TypeString);
1412 option.value ().set (value);
1413 }
1414
1415 resourceManager.push_back (option);
1416 }
1417 }
1418 }
1419
1420 XFree (data);
1421 }
1422
1423 int cursorSize = CompOption::getIntOptionNamed (resourceManager, "Xcursor.size", -1);
1424 CompString const& cursorTheme = CompOption::getStringOptionNamed (resourceManager, "Xcursor.theme");
1425
1426 if (cursorSize != oldCursorSize || cursorTheme != oldCursorTheme)
1427 screen->cursorChangeNotify (cursorTheme, cursorSize);
1428}
1429
1356bool1430bool
1357CompScreen::fileToImage (CompString &name,1431CompScreen::fileToImage (CompString &name,
1358 CompSize &size,1432 CompSize &size,
@@ -2078,9 +2152,9 @@
2078 if (priv->initialized)2152 if (priv->initialized)
2079 {2153 {
2080 if (!emptySequence())2154 if (!emptySequence())
2081 XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->busyCursor);2155 XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->cursorCache (busyCursorName));
2082 else2156 else
2083 XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->normalCursor);2157 XIDefineCursor (priv->dpy, priv->clientPointerDeviceId, priv->rootWindow(), priv->cursorCache (normalCursorName));
2084 }2158 }
2085}2159}
20862160
@@ -3012,7 +3086,7 @@
3012Cursor3086Cursor
3013CompScreenImpl::normalCursor ()3087CompScreenImpl::normalCursor ()
3014{3088{
3015 return privateScreen.normalCursor;3089 return privateScreen.cursorCache (normalCursorName);
3016}3090}
30173091
3018Cursor3092Cursor
@@ -3021,6 +3095,12 @@
3021 return privateScreen.invisibleCursor;3095 return privateScreen.invisibleCursor;
3022}3096}
30233097
3098Cursor
3099CompScreenImpl::cursorCache (unsigned int cursorName)
3100{
3101 return privateScreen.cursorCache (cursorName);
3102}
3103
3024#define POINTER_GRAB_MASK (ButtonReleaseMask | \3104#define POINTER_GRAB_MASK (ButtonReleaseMask | \
3025 ButtonPressMask | \3105 ButtonPressMask | \
3026 PointerMotionMask)3106 PointerMotionMask)
@@ -3302,10 +3382,19 @@
3302 * This is so that we can detect taps on individual modifier3382 * This is so that we can detect taps on individual modifier
3303 * keys, and know to cancel the tap if <modifier>+k is pressed.3383 * keys, and know to cancel the tap if <modifier>+k is pressed.
3304 */3384 */
3305 if (!(currentState & CompAction::StateIgnoreTap))3385 int minCode, maxCode;
3306 {3386 XDisplayKeycodes (screen->dpy(), &minCode, &maxCode);
3307 int minCode, maxCode;3387
3308 XDisplayKeycodes (screen->dpy(), &minCode, &maxCode);3388 if ((currentState & CompAction::StateIgnoreTap))
3389 {
3390 KeyCode code_p = XKeysymToKeycode(screen->dpy(), XK_p);
3391
3392 for (k = minCode; k <= maxCode; k++)
3393 if (k != code_p)
3394 grabUngrabOneKey (modifiers | ignore, k, grab);
3395 }
3396 else
3397 {
3309 for (k = minCode; k <= maxCode; k++)3398 for (k = minCode; k <= maxCode; k++)
3310 grabUngrabOneKey (modifiers | modifierForKeycode | ignore, k, grab);3399 grabUngrabOneKey (modifiers | modifierForKeycode | ignore, k, grab);
3311 }3400 }
@@ -3782,11 +3871,11 @@
3782 setsid ();3871 setsid ();
37833872
3784 pos = env.find (':');3873 pos = env.find (':');
3785 if (pos != std::string::npos)3874 if (pos != CompString::npos)
3786 {3875 {
3787 size_t pointPos = env.find ('.', pos);3876 size_t pointPos = env.find ('.', pos);
37883877
3789 if (pointPos != std::string::npos)3878 if (pointPos != CompString::npos)
3790 {3879 {
3791 env.erase (pointPos);3880 env.erase (pointPos);
3792 }3881 }
@@ -4066,6 +4155,53 @@
4066{4155{
4067}4156}
40684157
4158void
4159CompScreen::cursorChangeNotify (const CompString& theme, int size)
4160{
4161 WRAPABLE_HND_FUNCTN (cursorChangeNotify, theme, size);
4162 _cursorChangeNotify (theme, size);
4163}
4164
4165Cursor
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 XcursorSetDefaultSize (dpy, size);
4184 XcursorSetTheme (dpy, theme.c_str());
4185
4186 for (auto it = begin (cursors); it != end (cursors); ++it)
4187 {
4188 if (*it)
4189 {
4190 XFreeCursor (dpy, *it);
4191 *it = XCreateFontCursor (dpy, it - begin (cursors));
4192 }
4193 }
4194
4195 XIDefineCursor (dpy, clientPointerDeviceId, root, cursorCache (normalCursorName));
4196 startupSequence.updateStartupFeedback ();
4197}
4198
4199void
4200CompScreenImpl::_cursorChangeNotify (const CompString& theme, int size)
4201{
4202 privateScreen.updateCursors (theme, size);
4203}
4204
4069/* Returns default viewport for some window geometry. If the window spans4205/* Returns default viewport for some window geometry. If the window spans
4070 * more than one viewport the most appropriate viewport is returned. How the4206 * more than one viewport the most appropriate viewport is returned. How the
4071 * most appropriate viewport is computed can be made optional if necessary. It4207 * most appropriate viewport is computed can be made optional if necessary. It
@@ -4208,6 +4344,9 @@
4208ScreenInterface::addSupportedAtoms (std::vector<Atom>& atoms)4344ScreenInterface::addSupportedAtoms (std::vector<Atom>& atoms)
4209 WRAPABLE_DEF (addSupportedAtoms, atoms)4345 WRAPABLE_DEF (addSupportedAtoms, atoms)
42104346
4347void
4348ScreenInterface::cursorChangeNotify (const CompString& theme, int size)
4349 WRAPABLE_DEF (cursorChangeNotify, theme, size)
42114350
4212Window4351Window
4213CompScreenImpl::root ()4352CompScreenImpl::root ()
@@ -5060,12 +5199,10 @@
5060 eventManager.setSupportingWmCheck (dpy, rootWindow());5199 eventManager.setSupportingWmCheck (dpy, rootWindow());
5061 screen->updateSupportedWmHints ();5200 screen->updateSupportedWmHints ();
50625201
5202
5063 XIGetClientPointer (dpy, None, &clientPointerDeviceId);5203 XIGetClientPointer (dpy, None, &clientPointerDeviceId);
50645204 updateCursors (XcursorGetTheme (dpy), XcursorGetDefaultSize (dpy));
5065 normalCursor = XCreateFontCursor (dpy, XC_left_ptr);5205 updateResources ();
5066 busyCursor = XCreateFontCursor (dpy, XC_watch);
5067
5068 XIDefineCursor (dpy, clientPointerDeviceId, rootWindow(), normalCursor);
50695206
5070 /* Attempt to gain SubstructureRedirectMask */5207 /* Attempt to gain SubstructureRedirectMask */
5071 CompScreenImpl::checkForError (dpy);5208 CompScreenImpl::checkForError (dpy);
@@ -5241,8 +5378,6 @@
5241 currentDesktop (0),5378 currentDesktop (0),
5242 wmSnSelectionWindow (None),5379 wmSnSelectionWindow (None),
5243 clientPointerDeviceId (None),5380 clientPointerDeviceId (None),
5244 normalCursor (None),
5245 busyCursor (None),
5246 invisibleCursor (None),5381 invisibleCursor (None),
5247 initialized (false),5382 initialized (false),
5248 screen(screen),5383 screen(screen),
@@ -5363,11 +5498,8 @@
53635498
5364 eventManager.destroyGrabWindow (dpy);5499 eventManager.destroyGrabWindow (dpy);
53655500
5366 if (normalCursor != None)5501 for (auto cursor : cursors)
5367 XFreeCursor (dpy, normalCursor);5502 XFreeCursor (dpy, cursor);
5368
5369 if (busyCursor != None)
5370 XFreeCursor (dpy, busyCursor);
53715503
5372 if (invisibleCursor != None)5504 if (invisibleCursor != None)
5373 XFreeCursor (dpy, invisibleCursor);5505 XFreeCursor (dpy, invisibleCursor);

Subscribers

People subscribed via source and target branches