diff options
author | Simon Rettberg | 2022-01-20 13:33:11 +0100 |
---|---|---|
committer | Simon Rettberg | 2022-01-20 13:33:11 +0100 |
commit | 3d748ebe7d900e96670ff3d455896998dfba6191 (patch) | |
tree | e8bbaf6531897a2292da2158a46e9dce3df96baf /jwxyz/jwxyz-cocoa.m | |
parent | Re-sync dpms settings on unblank (diff) | |
download | xscreensaver-3d748ebe7d900e96670ff3d455896998dfba6191.tar.gz xscreensaver-3d748ebe7d900e96670ff3d455896998dfba6191.tar.xz xscreensaver-3d748ebe7d900e96670ff3d455896998dfba6191.zip |
Diffstat (limited to 'jwxyz/jwxyz-cocoa.m')
-rw-r--r-- | jwxyz/jwxyz-cocoa.m | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/jwxyz/jwxyz-cocoa.m b/jwxyz/jwxyz-cocoa.m index 13666e7..32a3dba 100644 --- a/jwxyz/jwxyz-cocoa.m +++ b/jwxyz/jwxyz-cocoa.m @@ -24,7 +24,7 @@ #include <stdarg.h> -#ifdef USE_IPHONE +#ifdef HAVE_IPHONE # import <OpenGLES/ES1/gl.h> # import <OpenGLES/ES1/glext.h> # define NSOpenGLContext EAGLContext @@ -99,7 +99,7 @@ jwxyz_scale_1 (Window main_window, BOOL fonts_p) { float scale = 1; -# ifdef USE_IPHONE +# ifdef HAVE_IPHONE /* Since iOS screens are physically smaller than desktop screens, scale up the fonts to make them more readable. @@ -112,12 +112,12 @@ jwxyz_scale_1 (Window main_window, BOOL fonts_p) if (scale < 1) // iPad Pro magnifies the backbuffer by 3x, which makes text scale = 1; // excessively blurry in BSOD. -# else // !USE_IPHONE +# else // !HAVE_IPHONE /* Desktop retina displays also need fonts doubled. */ scale = [main_window->window.view hackedContentScaleFactor:fonts_p]; -# endif // !USE_IPHONE +# endif // !HAVE_IPHONE return scale; } @@ -193,7 +193,7 @@ utf8_metrics (Display *dpy, NSFont *nsfont, NSString *nsstr, XCharStruct *cs) CGFloat advancement = CTRunGetTypographicBounds (run, r, &ascent, &descent, &leading); -# ifndef USE_IPHONE +# ifndef HAVE_IPHONE // Only necessary for when LCD smoothing is enabled, which iOS doesn't do. bbox.origin.x -= 2.0/3.0; bbox.size.width += 4.0/3.0; @@ -234,7 +234,7 @@ utf8_metrics (Display *dpy, NSFont *nsfont, NSString *nsstr, XCharStruct *cs) static NSArray * font_family_members (NSString *family_name) { -# ifndef USE_IPHONE +# ifndef HAVE_IPHONE return [[NSFontManager sharedFontManager] availableMembersOfFontFamily:family_name]; # else @@ -275,7 +275,7 @@ try_font (NSFontTraitMask traits, NSFontTraitMask mask, traits & NSFixedPitchFontMask ? JWXYZ_STYLE_MONOSPACE : 0)]); } -# ifndef USE_IPHONE +# ifndef HAVE_IPHONE for (unsigned k = 0; k != family_members.count; ++k) { NSArray *member = [family_members objectAtIndex:k]; @@ -308,7 +308,7 @@ try_font (NSFontTraitMask traits, NSFontTraitMask mask, return f; } } -# else // USE_IPHONE +# else // HAVE_IPHONE // This trick needs iOS 3.1, see "Using SDK-Based Development". Class has_font_descriptor = [UIFontDescriptor class]; @@ -370,7 +370,7 @@ static NSFont * random_font (NSFontTraitMask traits, NSFontTraitMask mask, float size) { -# ifndef USE_IPHONE +# ifndef HAVE_IPHONE // Providing Unbold or Unitalic in the mask for availableFontNamesWithTraits // returns an empty list, at least on a system with default fonts only. NSArray *families = [[NSFontManager sharedFontManager] @@ -395,7 +395,7 @@ random_font (NSFontTraitMask traits, NSFontTraitMask mask, float size) families = new_families; } -# endif // USE_IPHONE +# endif // HAVE_IPHONE long n = [families count]; if (n <= 0) return 0; @@ -563,7 +563,7 @@ jwxyz_render_text (Display *dpy, void *native_font, void jwxyz_get_pos (Window w, XPoint *xvpos, XPoint *xp) { -# ifdef USE_IPHONE +# ifdef HAVE_IPHONE xvpos->x = 0; xvpos->y = 0; @@ -573,7 +573,7 @@ jwxyz_get_pos (Window w, XPoint *xvpos, XPoint *xp) xp->y = w->window.last_mouse_y; } -# else // !USE_IPHONE +# else // !HAVE_IPHONE NSWindow *nsw = [w->window.view window]; @@ -631,11 +631,11 @@ jwxyz_get_pos (Window w, XPoint *xvpos, XPoint *xp) xp->y = (int) p.y; } -# endif // !USE_IPHONE +# endif // !HAVE_IPHONE } -#ifdef USE_IPHONE +#ifdef HAVE_IPHONE void check_framebuffer_status (void) @@ -693,7 +693,7 @@ create_framebuffer (GLuint *gl_framebuffer, GLuint *gl_renderbuffer) glBindRenderbufferOES (GL_RENDERBUFFER_OES, *gl_renderbuffer); } -#endif // USE_IPHONE +#endif // HAVE_IPHONE #if defined JWXYZ_QUARTZ @@ -841,7 +841,7 @@ jwxyz_copy_area (Display *dpy, Drawable src, Drawable dst, GC gc, /* Strange and ugly flickering when going the glCopyTexImage2D route on OS X. (Early 2009 Mac mini, OS X 10.10) */ -# ifdef USE_IPHONE +# ifdef HAVE_IPHONE /* TODO: This might not still work. */ jwxyz_bind_drawable (dpy, dpy->main_window, src); @@ -850,10 +850,10 @@ jwxyz_copy_area (Display *dpy, Drawable src, Drawable dst, GC gc, jwxyz_bind_drawable (dpy, dpy->main_window, dst); jwxyz_gl_copy_area_write_tex_image (dpy, gc, src_x, src_y, width, height, dst_x, dst_y); -# else // !USE_IPHONE +# else // !HAVE_IPHONE jwxyz_gl_copy_area_read_pixels (dpy, src, dst, gc, src_x, src_y, width, height, dst_x, dst_y); -# endif // !USE_IPHONE +# endif // !HAVE_IPHONE jwxyz_assert_gl (); } @@ -877,7 +877,7 @@ jwxyz_assert_gl () void jwxyz_assert_drawable (Window main_window, Drawable d) { -#if !defined USE_IPHONE && !defined __OPTIMIZE__ +#if !defined HAVE_IPHONE && !defined __OPTIMIZE__ XScreenSaverView *view = main_window->window.view; NSOpenGLContext *ogl_ctx = [view oglContext]; @@ -896,7 +896,7 @@ jwxyz_assert_drawable (Window main_window, Drawable d) perror([[exception reason] UTF8String]); jwxyz_abort(); } -#endif // !USE_IPHONE && !__OPTIMIZE__ +#endif // !HAVE_IPHONE && !__OPTIMIZE__ } @@ -925,7 +925,7 @@ jwxyz_bind_drawable (Window main_window, Drawable d) jwxyz_assert_gl (); jwxyz_assert_drawable (main_window, d); -#if defined USE_IPHONE && !defined __OPTIMIZE__ +#if defined HAVE_IPHONE && !defined __OPTIMIZE__ Drawable current_drawable = main_window->window.current_drawable; Assert (!current_drawable || current_drawable->ogl_ctx == [EAGLContext currentContext], @@ -942,7 +942,7 @@ jwxyz_bind_drawable (Window main_window, Drawable d) main_window->window.current_drawable = d; /* Doing this repeatedly is probably not OK performance-wise. Probably. */ -#ifndef USE_IPHONE +#ifndef HAVE_IPHONE [d->ogl_ctx makeCurrentContext]; #else [EAGLContext setCurrentContext:d->ogl_ctx]; @@ -973,7 +973,7 @@ XCreatePixmap (Display *dpy, Drawable d, /* TODO: If Pixel buffers are not supported, do something about it. */ Window w = XRootWindow (dpy, 0); -# ifndef USE_IPHONE +# ifndef HAVE_IPHONE p->ogl_ctx = [[NSOpenGLContext alloc] initWithFormat:w->window.pixfmt @@ -997,7 +997,7 @@ XCreatePixmap (Display *dpy, Drawable d, mipMapLevel:0 currentVirtualScreen:w->window.virtual_screen]; -# else // USE_IPHONE +# else // HAVE_IPHONE p->ogl_ctx = w->window.ogl_ctx_pixmap; @@ -1012,7 +1012,7 @@ XCreatePixmap (Display *dpy, Drawable d, glBindFramebufferOES(GL_FRAMEBUFFER_OES, p->gl_framebuffer); -# endif // USE_IPHONE +# endif // HAVE_IPHONE w->window.current_drawable = p; glViewport (0, 0, width, height); @@ -1033,16 +1033,16 @@ XFreePixmap (Display *d, Pixmap p) Window w = RootWindow (d, 0); -# ifndef USE_IPHONE +# ifndef HAVE_IPHONE CFRelease (p->ogl_ctx); [p->ogl_ctx release]; CFRelease (p->pixmap.gl_pbuffer); [p->pixmap.gl_pbuffer release]; -# else // USE_IPHONE +# else // HAVE_IPHONE glDeleteRenderbuffersOES (1, &p->gl_renderbuffer); glDeleteFramebuffersOES (1, &p->gl_framebuffer); -# endif // USE_IPHONE +# endif // HAVE_IPHONE if (w->window.current_drawable == p) { w->window.current_drawable = NULL; |