From 00e0a5f2ce568f56cbfebed1a7eef4ced5ef09eb Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 1 Apr 2020 19:36:01 +0200 Subject: Consistently use "view" terminology in API The sloppy use of "window" caused quite a bit of confusion, since views only correspond to top-level windows in some cases, and on MacOS, a non-top-level view is not a "window" at all. --- pugl/detail/implementation.c | 8 ++++---- pugl/detail/mac.m | 4 ++-- pugl/detail/types.h | 4 ++-- pugl/detail/win.c | 4 ++-- pugl/detail/win.h | 4 ++-- pugl/detail/x11.c | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) (limited to 'pugl/detail') diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c index 1454899..6bb019d 100644 --- a/pugl/detail/implementation.c +++ b/pugl/detail/implementation.c @@ -62,8 +62,8 @@ puglStrerror(const PuglStatus status) case PUGL_BAD_BACKEND: return "Invalid or missing backend"; case PUGL_BAD_PARAMETER: return "Invalid parameter"; case PUGL_BACKEND_FAILED: return "Backend initialisation failed"; - case PUGL_REGISTRATION_FAILED: return "Window class registration failed"; - case PUGL_CREATE_WINDOW_FAILED: return "Window creation failed"; + case PUGL_REGISTRATION_FAILED: return "Class registration failed"; + case PUGL_REALIZE_FAILED: return "View creation failed"; case PUGL_SET_FORMAT_FAILED: return "Failed to set pixel format"; case PUGL_CREATE_CONTEXT_FAILED: return "Failed to create drawing context"; case PUGL_UNSUPPORTED_TYPE: return "Unsupported data type"; @@ -237,7 +237,7 @@ puglGetWorld(PuglView* view) PuglStatus puglSetViewHint(PuglView* view, PuglViewHint hint, int value) { - if (hint < PUGL_NUM_WINDOW_HINTS) { + if (hint < PUGL_NUM_VIEW_HINTS) { view->hints[hint] = value; return PUGL_SUCCESS; } @@ -246,7 +246,7 @@ puglSetViewHint(PuglView* view, PuglViewHint hint, int value) } PuglStatus -puglSetParentWindow(PuglView* view, PuglNativeWindow parent) +puglSetParentWindow(PuglView* view, PuglNativeView parent) { view->parent = parent; return PUGL_SUCCESS; diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m index 43dca9e..c495ee4 100644 --- a/pugl/detail/mac.m +++ b/pugl/detail/mac.m @@ -1072,10 +1072,10 @@ puglPostRedisplayRect(PuglView* view, const PuglRect rect) return PUGL_SUCCESS; } -PuglNativeWindow +PuglNativeView puglGetNativeWindow(PuglView* view) { - return (PuglNativeWindow)view->impl->wrapperView; + return (PuglNativeView)view->impl->wrapperView; } PuglStatus diff --git a/pugl/detail/types.h b/pugl/detail/types.h index e750ca1..eb450e1 100644 --- a/pugl/detail/types.h +++ b/pugl/detail/types.h @@ -43,7 +43,7 @@ typedef struct PuglWorldInternalsImpl PuglWorldInternals; typedef struct PuglInternalsImpl PuglInternals; /** View hints. */ -typedef int PuglHints[PUGL_NUM_WINDOW_HINTS]; +typedef int PuglHints[PUGL_NUM_VIEW_HINTS]; /** Blob of arbitrary data. */ typedef struct { @@ -60,7 +60,7 @@ struct PuglViewImpl { PuglEventFunc eventFunc; char* title; PuglBlob clipboard; - PuglNativeWindow parent; + PuglNativeView parent; uintptr_t transientParent; PuglHints hints; PuglRect frame; diff --git a/pugl/detail/win.c b/pugl/detail/win.c index 6d8a99e..44ba6cd 100644 --- a/pugl/detail/win.c +++ b/pugl/detail/win.c @@ -906,10 +906,10 @@ puglPostRedisplayRect(PuglView* view, const PuglRect rect) return PUGL_SUCCESS; } -PuglNativeWindow +PuglNativeView puglGetNativeWindow(PuglView* view) { - return (PuglNativeWindow)view->impl->hwnd; + return (PuglNativeView)view->impl->hwnd; } PuglStatus diff --git a/pugl/detail/win.h b/pugl/detail/win.h index 283f39e..949fa90 100644 --- a/pugl/detail/win.h +++ b/pugl/detail/win.h @@ -106,11 +106,11 @@ puglWinCreateWindow(const PuglView* const view, CW_USEDEFAULT, CW_USEDEFAULT, wr.right-wr.left, wr.bottom-wr.top, (HWND)view->parent, NULL, NULL, NULL))) { - return PUGL_CREATE_WINDOW_FAILED; + return PUGL_REALIZE_FAILED; } else if (!(*hdc = GetDC(*hwnd))) { DestroyWindow(*hwnd); *hwnd = NULL; - return PUGL_CREATE_WINDOW_FAILED; + return PUGL_REALIZE_FAILED; } return PUGL_SUCCESS; diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index 59850c5..d959dbf 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -1061,10 +1061,10 @@ puglPostRedisplayRect(PuglView* view, PuglRect rect) return PUGL_SUCCESS; } -PuglNativeWindow +PuglNativeView puglGetNativeWindow(PuglView* view) { - return (PuglNativeWindow)view->impl->win; + return (PuglNativeView)view->impl->win; } PuglStatus @@ -1139,7 +1139,7 @@ puglSetAspectRatio(PuglView* const view, } PuglStatus -puglSetTransientFor(PuglView* view, PuglNativeWindow parent) +puglSetTransientFor(PuglView* view, PuglNativeView parent) { Display* display = view->world->impl->display; -- cgit v1.2.1