Changeset View
Changeset View
Standalone View
Standalone View
effects/zoom/zoom.cpp
Show First 20 Lines • Show All 182 Lines • ▼ Show 20 Line(s) | 180 | if (shouldHide) { | |||
---|---|---|---|---|---|
183 | isMouseHidden = true; | 183 | isMouseHidden = true; | ||
184 | } | 184 | } | ||
185 | } | 185 | } | ||
186 | } | 186 | } | ||
187 | 187 | | |||
188 | void ZoomEffect::recreateTexture() | 188 | void ZoomEffect::recreateTexture() | ||
189 | { | 189 | { | ||
190 | effects->makeOpenGLContextCurrent(); | 190 | effects->makeOpenGLContextCurrent(); | ||
191 | // load the cursor-theme image from the Xcursor-library | 191 | const auto cursor = effects->cursorImage(); | ||
192 | xcb_xfixes_get_cursor_image_cookie_t keks = xcb_xfixes_get_cursor_image_unchecked(xcbConnection()); | 192 | if (!cursor.image().isNull()) { | ||
193 | xcb_xfixes_get_cursor_image_reply_t *ximg = xcb_xfixes_get_cursor_image_reply(xcbConnection(), keks, 0); | 193 | imageWidth = cursor.image().width(); | ||
194 | if (ximg) { | 194 | imageHeight = cursor.image().height(); | ||
195 | // turn the XcursorImage into a QImage that will be used to create the GLTexture/XRenderPicture. | 195 | cursorHotSpot = cursor.hotSpot(); | ||
196 | imageWidth = ximg->width; | | |||
197 | imageHeight = ximg->height; | | |||
198 | cursorHotSpot = QPoint(ximg->xhot, ximg->yhot); | | |||
199 | uint32_t *bits = xcb_xfixes_get_cursor_image_cursor_image(ximg); | | |||
200 | QImage img((uchar*)bits, imageWidth, imageHeight, QImage::Format_ARGB32_Premultiplied); | | |||
201 | if (effects->isOpenGLCompositing()) | 196 | if (effects->isOpenGLCompositing()) | ||
202 | texture.reset(new GLTexture(img)); | 197 | texture.reset(new GLTexture(cursor.image())); | ||
203 | #ifdef KWIN_HAVE_XRENDER_COMPOSITING | 198 | #ifdef KWIN_HAVE_XRENDER_COMPOSITING | ||
204 | if (effects->compositingType() == XRenderCompositing) | 199 | if (effects->compositingType() == XRenderCompositing) | ||
205 | xrenderPicture.reset(new XRenderPicture(img)); | 200 | xrenderPicture.reset(new XRenderPicture(cursor.image())); | ||
206 | #endif | 201 | #endif | ||
207 | free(ximg); | | |||
208 | } | 202 | } | ||
209 | else { | 203 | else { | ||
210 | qCDebug(KWINEFFECTS) << "Falling back to proportional mouse tracking!"; | 204 | qCDebug(KWINEFFECTS) << "Falling back to proportional mouse tracking!"; | ||
211 | mouseTracking = MouseTrackingProportional; | 205 | mouseTracking = MouseTrackingProportional; | ||
212 | } | 206 | } | ||
213 | } | 207 | } | ||
214 | 208 | | |||
215 | void ZoomEffect::reconfigure(ReconfigureFlags) | 209 | void ZoomEffect::reconfigure(ReconfigureFlags) | ||
▲ Show 20 Lines • Show All 325 Lines • Show Last 20 Lines |