From 1c585b574df224e44c5063474e4577a3e749be05 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 4 Aug 2019 17:37:29 +0200 Subject: Use consistent naming conventions --- pugl/detail/implementation.c | 22 +++++++++++----------- pugl/detail/mac.m | 18 +++++++++--------- pugl/detail/types.h | 14 +++++++------- pugl/detail/win.c | 28 ++++++++++++++-------------- pugl/detail/x11.c | 42 +++++++++++++++++++++--------------------- 5 files changed, 62 insertions(+), 62 deletions(-) (limited to 'pugl/detail') diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c index 1b7d4a4..137bef9 100644 --- a/pugl/detail/implementation.c +++ b/pugl/detail/implementation.c @@ -146,21 +146,21 @@ puglInitWindowSize(PuglView* view, int width, int height) void puglInitWindowMinSize(PuglView* view, int width, int height) { - view->min_width = width; - view->min_height = height; + view->minWidth = width; + view->minHeight = height; } void puglInitWindowAspectRatio(PuglView* view, - int min_x, - int min_y, - int max_x, - int max_y) + int minX, + int minY, + int maxX, + int maxY) { - view->min_aspect_x = min_x; - view->min_aspect_y = min_y; - view->max_aspect_x = max_x; - view->max_aspect_y = max_y; + view->minAspectX = minX; + view->minAspectY = minY; + view->maxAspectX = maxX; + view->maxAspectY = maxY; } void @@ -188,7 +188,7 @@ puglInitResizable(PuglView* view, bool resizable) void puglInitTransientFor(PuglView* view, uintptr_t parent) { - view->transient_parent = parent; + view->transientParent = parent; } int diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m index b7495f4..ea55c0f 100644 --- a/pugl/detail/mac.m +++ b/pugl/detail/mac.m @@ -726,9 +726,9 @@ puglCreateWindow(PuglView* view, const char* title) [impl->wrapperView initWithFrame: NSMakeRect(0, 0, view->frame.width, view->frame.height)]; [impl->wrapperView addConstraint: - puglConstraint(impl->wrapperView, NSLayoutAttributeWidth, view->min_width)]; + puglConstraint(impl->wrapperView, NSLayoutAttributeWidth, view->minWidth)]; [impl->wrapperView addConstraint: - puglConstraint(impl->wrapperView, NSLayoutAttributeHeight, view->min_height)]; + puglConstraint(impl->wrapperView, NSLayoutAttributeHeight, view->minHeight)]; // Create draw view to be rendered to int st = 0; @@ -755,7 +755,7 @@ puglCreateWindow(PuglView* view, const char* title) const NSRect frame = rectToScreen( NSMakeRect(view->frame.x, view->frame.y, - view->min_width, view->min_height)); + view->minWidth, view->minHeight)); unsigned style = (NSClosableWindowMask | NSTitledWindowMask | @@ -772,18 +772,18 @@ puglCreateWindow(PuglView* view, const char* title) ] retain]; [window setPuglview:view]; [window setTitle:titleString]; - if (view->min_width || view->min_height) { - [window setContentMinSize:NSMakeSize(view->min_width, - view->min_height)]; + if (view->minWidth || view->minHeight) { + [window setContentMinSize:NSMakeSize(view->minWidth, + view->minHeight)]; } impl->window = window; ((NSWindow*)window).delegate = [[PuglWindowDelegate alloc] initWithPuglWindow:window]; - if (view->min_aspect_x && view->min_aspect_y) { - [window setContentAspectRatio:NSMakeSize(view->min_aspect_x, - view->min_aspect_y)]; + if (view->minAspectX && view->minAspectY) { + [window setContentAspectRatio:NSMakeSize(view->minAspectX, + view->minAspectY)]; } [window setContentView:impl->wrapperView]; diff --git a/pugl/detail/types.h b/pugl/detail/types.h index fa120f0..24cf219 100644 --- a/pugl/detail/types.h +++ b/pugl/detail/types.h @@ -54,15 +54,15 @@ struct PuglViewImpl { PuglEventFunc eventFunc; char* windowClass; PuglNativeWindow parent; - uintptr_t transient_parent; + uintptr_t transientParent; PuglHints hints; PuglRect frame; - int min_width; - int min_height; - int min_aspect_x; - int min_aspect_y; - int max_aspect_x; - int max_aspect_y; + int minWidth; + int minHeight; + int minAspectX; + int minAspectY; + int maxAspectX; + int maxAspectY; bool visible; bool redisplay; }; diff --git a/pugl/detail/win.c b/pugl/detail/win.c index 486c5e3..2c4074c 100644 --- a/pugl/detail/win.c +++ b/pugl/detail/win.c @@ -290,8 +290,8 @@ initMouseEvent(PuglEvent* event, event->button.type = press ? PUGL_BUTTON_PRESS : PUGL_BUTTON_RELEASE; event->button.x = GET_X_LPARAM(lParam); event->button.y = GET_Y_LPARAM(lParam); - event->button.x_root = pt.x; - event->button.y_root = pt.y; + event->button.xRoot = pt.x; + event->button.yRoot = pt.y; event->button.state = getModifiers(); event->button.button = (uint32_t)button; } @@ -306,8 +306,8 @@ initScrollEvent(PuglEvent* event, PuglView* view, LPARAM lParam) event->scroll.type = PUGL_SCROLL; event->scroll.x = pt.x; event->scroll.y = pt.y; - event->scroll.x_root = GET_X_LPARAM(lParam); - event->scroll.y_root = GET_Y_LPARAM(lParam); + event->scroll.xRoot = GET_X_LPARAM(lParam); + event->scroll.yRoot = GET_Y_LPARAM(lParam); event->scroll.state = getModifiers(); event->scroll.dx = 0; event->scroll.dy = 0; @@ -358,8 +358,8 @@ initKeyEvent(PuglEventKey* event, event->type = press ? PUGL_KEY_PRESS : PUGL_KEY_RELEASE; event->time = GetMessageTime() / 1e3; event->state = getModifiers(); - event->x_root = rpos.x; - event->y_root = rpos.y; + event->xRoot = rpos.x; + event->yRoot = rpos.y; event->x = cpos.x; event->y = cpos.y; event->keycode = (uint32_t)((lParam & 0xFF0000) >> 16); @@ -463,8 +463,8 @@ constrainAspect(const PuglView* const view, RECT* const size, const WPARAM wParam) { - const float minA = (float)view->min_aspect_x / (float)view->min_aspect_y; - const float maxA = (float)view->max_aspect_x / (float)view->max_aspect_y; + const float minA = (float)view->minAspectX / (float)view->minAspectY; + const float maxA = (float)view->maxAspectX / (float)view->maxAspectY; const int w = size->right - size->left; const int h = size->bottom - size->top; const float a = (float)w / (float)h; @@ -524,7 +524,7 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) InvalidateRect(view->impl->hwnd, NULL, false); break; case WM_SIZING: - if (view->min_aspect_x) { + if (view->minAspectX) { constrainAspect(view, (RECT*)lParam, wParam); return TRUE; } @@ -553,8 +553,8 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) break; case WM_GETMINMAXINFO: mmi = (MINMAXINFO*)lParam; - mmi->ptMinTrackSize.x = view->min_width; - mmi->ptMinTrackSize.y = view->min_height; + mmi->ptMinTrackSize.x = view->minWidth; + mmi->ptMinTrackSize.y = view->minHeight; break; case WM_PAINT: GetUpdateRect(view->impl->hwnd, &rect, false); @@ -588,10 +588,10 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam) event.motion.time = GetMessageTime() / 1e3; event.motion.x = GET_X_LPARAM(lParam); event.motion.y = GET_Y_LPARAM(lParam); - event.motion.x_root = pt.x; - event.motion.y_root = pt.y; + event.motion.xRoot = pt.x; + event.motion.yRoot = pt.y; event.motion.state = getModifiers(); - event.motion.is_hint = false; + event.motion.isHint = false; break; case WM_MOUSELEAVE: GetCursorPos(&pt); diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index 1f2a471..dd54644 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -187,17 +187,17 @@ puglCreateWindow(PuglView* view, const char* title) sizeHints.max_width = width; sizeHints.max_height = height; } else { - if (view->min_width || view->min_height) { + if (view->minWidth || view->minHeight) { sizeHints.flags = PMinSize; - sizeHints.min_width = view->min_width; - sizeHints.min_height = view->min_height; + sizeHints.min_width = view->minWidth; + sizeHints.min_height = view->minHeight; } - if (view->min_aspect_x) { + if (view->minAspectX) { sizeHints.flags |= PAspect; - sizeHints.min_aspect.x = view->min_aspect_x; - sizeHints.min_aspect.y = view->min_aspect_y; - sizeHints.max_aspect.x = view->max_aspect_x; - sizeHints.max_aspect.y = view->max_aspect_y; + sizeHints.min_aspect.x = view->minAspectX; + sizeHints.min_aspect.y = view->minAspectY; + sizeHints.max_aspect.x = view->maxAspectX; + sizeHints.max_aspect.y = view->maxAspectY; } } XSetNormalHints(display, win, &sizeHints); @@ -213,8 +213,8 @@ puglCreateWindow(PuglView* view, const char* title) XSetWMProtocols(display, win, &atoms->WM_DELETE_WINDOW, 1); } - if (view->transient_parent) { - XSetTransientForHint(display, win, (Window)(view->transient_parent)); + if (view->transientParent) { + XSetTransientForHint(display, win, (Window)(view->transientParent)); } // Create input context @@ -421,10 +421,10 @@ translateEvent(PuglView* view, XEvent xevent) event.motion.time = xevent.xmotion.time / 1e3; event.motion.x = xevent.xmotion.x; event.motion.y = xevent.xmotion.y; - event.motion.x_root = xevent.xmotion.x_root; - event.motion.y_root = xevent.xmotion.y_root; + event.motion.xRoot = xevent.xmotion.x_root; + event.motion.yRoot = xevent.xmotion.y_root; event.motion.state = translateModifiers(xevent.xmotion.state); - event.motion.is_hint = (xevent.xmotion.is_hint == NotifyHint); + event.motion.isHint = (xevent.xmotion.is_hint == NotifyHint); break; case ButtonPress: if (xevent.xbutton.button >= 4 && xevent.xbutton.button <= 7) { @@ -432,8 +432,8 @@ translateEvent(PuglView* view, XEvent xevent) event.scroll.time = xevent.xbutton.time / 1e3; event.scroll.x = xevent.xbutton.x; event.scroll.y = xevent.xbutton.y; - event.scroll.x_root = xevent.xbutton.x_root; - event.scroll.y_root = xevent.xbutton.y_root; + event.scroll.xRoot = xevent.xbutton.x_root; + event.scroll.yRoot = xevent.xbutton.y_root; event.scroll.state = translateModifiers(xevent.xbutton.state); event.scroll.dx = 0.0; event.scroll.dy = 0.0; @@ -454,8 +454,8 @@ translateEvent(PuglView* view, XEvent xevent) event.button.time = xevent.xbutton.time / 1e3; event.button.x = xevent.xbutton.x; event.button.y = xevent.xbutton.y; - event.button.x_root = xevent.xbutton.x_root; - event.button.y_root = xevent.xbutton.y_root; + event.button.xRoot = xevent.xbutton.x_root; + event.button.yRoot = xevent.xbutton.y_root; event.button.state = translateModifiers(xevent.xbutton.state); event.button.button = xevent.xbutton.button; } @@ -468,8 +468,8 @@ translateEvent(PuglView* view, XEvent xevent) event.key.time = xevent.xkey.time / 1e3; event.key.x = xevent.xkey.x; event.key.y = xevent.xkey.y; - event.key.x_root = xevent.xkey.x_root; - event.key.y_root = xevent.xkey.y_root; + event.key.xRoot = xevent.xkey.x_root; + event.key.yRoot = xevent.xkey.y_root; event.key.state = translateModifiers(xevent.xkey.state); translateKey(view, &xevent, &event); break; @@ -481,8 +481,8 @@ translateEvent(PuglView* view, XEvent xevent) event.crossing.time = xevent.xcrossing.time / 1e3; event.crossing.x = xevent.xcrossing.x; event.crossing.y = xevent.xcrossing.y; - event.crossing.x_root = xevent.xcrossing.x_root; - event.crossing.y_root = xevent.xcrossing.y_root; + event.crossing.xRoot = xevent.xcrossing.x_root; + event.crossing.yRoot = xevent.xcrossing.y_root; event.crossing.state = translateModifiers(xevent.xcrossing.state); event.crossing.mode = PUGL_CROSSING_NORMAL; if (xevent.xcrossing.mode == NotifyGrab) { -- cgit v1.2.1