This largely applies to the variables and functions declared in `macdrv_cocoa.h`, which (currently) cannot use Win32 types.
Note that for ObjC method signatures, I'm following the advice of Google's [Objective-C Style Guide](https://google.github.io/styleguide/objcguide.html#bool-pitfalls) and sticking with ObjC `BOOL` in method signatures (like `- (void) setRetinaMode:(BOOL)mode`). I think the motivation behind that is to avoid confusion between `BOOL` and `bool` when overriding methods: on some architectures (ARM64) they're the same, on others (Intel) they aren't, so just stick with ObjC BOOL everywhere.
-- v2: winemac.drv: Use C99 bool instead of int for Boolean values.
From: Brendan Shanks bshanks@codeweavers.com
--- dlls/winemac.drv/cocoa_app.h | 2 +- dlls/winemac.drv/cocoa_app.m | 22 +++---- dlls/winemac.drv/cocoa_clipboard.m | 8 +-- dlls/winemac.drv/cocoa_cursorclipping.h | 2 +- dlls/winemac.drv/cocoa_cursorclipping.m | 6 +- dlls/winemac.drv/cocoa_window.h | 2 +- dlls/winemac.drv/cocoa_window.m | 40 ++++++------- dlls/winemac.drv/gdi.c | 8 +-- dlls/winemac.drv/macdrv.h | 2 +- dlls/winemac.drv/macdrv_cocoa.h | 79 +++++++++++++------------ dlls/winemac.drv/macdrv_main.c | 22 +++---- dlls/winemac.drv/window.c | 2 +- 12 files changed, 98 insertions(+), 97 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.h b/dlls/winemac.drv/cocoa_app.h index f14b31876f6..85d252abb7e 100644 --- a/dlls/winemac.drv/cocoa_app.h +++ b/dlls/winemac.drv/cocoa_app.h @@ -113,7 +113,7 @@ - (double) ticksForEventTime:(NSTimeInterval)eventTime;
- (void) windowGotFocus:(WineWindow*)window;
- - (BOOL) waitUntilQueryDone:(int*)done timeout:(NSDate*)timeout processEvents:(BOOL)processEvents; + - (BOOL) waitUntilQueryDone:(bool*)done timeout:(NSDate*)timeout processEvents:(BOOL)processEvents;
- (void) noteKey:(uint16_t)keyCode pressed:(BOOL)pressed;
diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index 25696ba38c4..9c7e5d770bf 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -41,7 +41,7 @@ static NSString* const WineActivatingAppConfigDirKey = @"ActivatingAppConfigDir";
-int macdrv_err_on; +bool macdrv_err_on;
#if !defined(MAC_OS_VERSION_14_0) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_14_0 @@ -305,7 +305,7 @@ - (void) transformProcessToForeground:(BOOL)activateIfTransformed } }
- - (BOOL) waitUntilQueryDone:(int*)done timeout:(NSDate*)timeout processEvents:(BOOL)processEvents + - (BOOL) waitUntilQueryDone:(bool*)done timeout:(NSDate*)timeout processEvents:(BOOL)processEvents { PerformRequest(NULL);
@@ -2137,7 +2137,7 @@ - (void) unminimizeWindowIfNoneVisible [bestOption deminiaturize:self]; }
- - (void) setRetinaMode:(int)mode + - (void) setRetinaMode:(BOOL)mode { retina_on = mode;
@@ -2396,7 +2396,7 @@ void macdrv_window_rejected_focus(const macdrv_event *event) * * Returns the keyboard layout uchr data, keyboard type and input source. */ -void macdrv_get_input_source_info(CFDataRef* uchr, CGEventSourceKeyboardType* keyboard_type, int* is_iso, TISInputSourceRef* input_source) +void macdrv_get_input_source_info(CFDataRef* uchr, CGEventSourceKeyboardType* keyboard_type, bool* is_iso, TISInputSourceRef* input_source) { OnMainThread(^{ TISInputSourceRef inputSourceLayout; @@ -2610,9 +2610,9 @@ void macdrv_quit_reply(int reply) /*********************************************************************** * macdrv_using_input_method */ -int macdrv_using_input_method(void) +bool macdrv_using_input_method(void) { - __block BOOL ret; + __block bool ret;
OnMainThread(^{ ret = [[WineApplicationController sharedController] inputSourceIsInputMethod]; @@ -2684,9 +2684,9 @@ CFArrayRef macdrv_create_input_source_list(void) return ret; }
-int macdrv_select_input_source(TISInputSourceRef input_source) +bool macdrv_select_input_source(TISInputSourceRef input_source) { - __block int ret = FALSE; + __block bool ret = false;
OnMainThread(^{ ret = (TISSelectInputSource(input_source) == noErr); @@ -2695,16 +2695,16 @@ int macdrv_select_input_source(TISInputSourceRef input_source) return ret; }
-void macdrv_set_cocoa_retina_mode(int new_mode) +void macdrv_set_cocoa_retina_mode(bool new_mode) { OnMainThread(^{ [[WineApplicationController sharedController] setRetinaMode:new_mode]; }); }
-int macdrv_is_any_wine_window_visible(void) +bool macdrv_is_any_wine_window_visible(void) { - __block int ret = FALSE; + __block bool ret = false;
OnMainThread(^{ ret = [[WineApplicationController sharedController] isAnyWineWindowVisible]; diff --git a/dlls/winemac.drv/cocoa_clipboard.m b/dlls/winemac.drv/cocoa_clipboard.m index 4994442f1df..1eb9995b4eb 100644 --- a/dlls/winemac.drv/cocoa_clipboard.m +++ b/dlls/winemac.drv/cocoa_clipboard.m @@ -46,9 +46,9 @@ /*********************************************************************** * macdrv_is_pasteboard_owner */ -int macdrv_is_pasteboard_owner(macdrv_window w) +bool macdrv_is_pasteboard_owner(macdrv_window w) { - __block int ret; + __block bool ret; WineWindow* window = (WineWindow*)w;
OnMainThread(^{ @@ -65,10 +65,10 @@ int macdrv_is_pasteboard_owner(macdrv_window w) /*********************************************************************** * macdrv_has_pasteboard_changed */ -int macdrv_has_pasteboard_changed(void) +bool macdrv_has_pasteboard_changed(void) { __block int new_change_count; - int ret; + bool ret;
OnMainThread(^{ NSPasteboard* pb = [NSPasteboard generalPasteboard]; diff --git a/dlls/winemac.drv/cocoa_cursorclipping.h b/dlls/winemac.drv/cocoa_cursorclipping.h index bec7b384d87..8912714f14a 100644 --- a/dlls/winemac.drv/cocoa_cursorclipping.h +++ b/dlls/winemac.drv/cocoa_cursorclipping.h @@ -32,7 +32,7 @@ - (BOOL) stopClippingCursor;
- (void) clipCursorLocation:(CGPoint*)location;
- - (void) setRetinaMode:(int)mode; + - (void) setRetinaMode:(BOOL)mode;
@optional /* If provided, should reposition the cursor as needed given the current diff --git a/dlls/winemac.drv/cocoa_cursorclipping.m b/dlls/winemac.drv/cocoa_cursorclipping.m index b7dc0b322b1..b6151a2c8c4 100644 --- a/dlls/winemac.drv/cocoa_cursorclipping.m +++ b/dlls/winemac.drv/cocoa_cursorclipping.m @@ -101,7 +101,7 @@ static void clip_cursor_location(CGRect cursorClipRect, CGPoint *location) }
-static void scale_rect_for_retina_mode(int mode, CGRect *cursorClipRect) +static void scale_rect_for_retina_mode(BOOL mode, CGRect *cursorClipRect) { double scale = mode ? 0.5 : 2.0; cursorClipRect->origin.x *= scale; @@ -378,7 +378,7 @@ - (void) clipCursorLocation:(CGPoint*)location clip_cursor_location(cursorClipRect, location); }
- - (void) setRetinaMode:(int)mode + - (void) setRetinaMode:(BOOL)mode { scale_rect_for_retina_mode(mode, &cursorClipRect); } @@ -499,7 +499,7 @@ - (void) clipCursorLocation:(CGPoint*)location clip_cursor_location(cursorClipRect, location); }
- - (void) setRetinaMode:(int)mode + - (void) setRetinaMode:(BOOL)mode { scale_rect_for_retina_mode(mode, &cursorClipRect); } diff --git a/dlls/winemac.drv/cocoa_window.h b/dlls/winemac.drv/cocoa_window.h index 0f4e5b44836..23ecd6dae2c 100644 --- a/dlls/winemac.drv/cocoa_window.h +++ b/dlls/winemac.drv/cocoa_window.h @@ -110,6 +110,6 @@ - (WineWindow*) ancestorWineWindow;
- (void) updateForCursorClipping;
- - (void) setRetinaMode:(int)mode; + - (void) setRetinaMode:(BOOL)mode;
@end diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 2ecf5183e94..d8d2ebf5178 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -430,7 +430,7 @@ - (void) windowDidDrawContent;
@implementation WineBaseView
- - (void) setRetinaMode:(int)mode + - (void) setRetinaMode:(BOOL)mode { for (WineBaseView* subview in [self subviews]) { @@ -699,7 +699,7 @@ - (WineMetalView*) newMetalViewWithDevice:(id<MTLDevice>)device return _metalView; }
- - (void) setLayerRetinaProperties:(int)mode + - (void) setLayerRetinaProperties:(BOOL)mode { [self layer].contentsScale = mode ? 2.0 : 1.0; [self layer].minificationFilter = mode ? kCAFilterLinear : kCAFilterNearest; @@ -722,7 +722,7 @@ - (void) setLayerRetinaProperties:(int)mode } }
- - (void) setRetinaMode:(int)mode + - (void) setRetinaMode:(BOOL)mode { double scale = mode ? 0.5 : 2.0; NSRect frame = self.frame; @@ -784,7 +784,7 @@ - (void) completeText:(NSString*)text event = macdrv_create_event(IM_SET_TEXT, window); event->im_set_text.himc = [window himc]; event->im_set_text.text = (CFStringRef)[text copy]; - event->im_set_text.complete = TRUE; + event->im_set_text.complete = true;
[[window queue] postEvent:event];
@@ -867,7 +867,7 @@ - (void) setMarkedText:(id)string selectedRange:(NSRange)selectedRange replaceme event = macdrv_create_event(IM_SET_TEXT, window); event->im_set_text.himc = [window himc]; event->im_set_text.text = (CFStringRef)[[markedText string] copy]; - event->im_set_text.complete = FALSE; + event->im_set_text.complete = false; event->im_set_text.cursor_begin = markedTextSelection.location; event->im_set_text.cursor_end = markedTextSelection.location + markedTextSelection.length;
@@ -969,7 +969,7 @@ - (void) dealloc [super dealloc]; }
- - (void) setRetinaMode:(int)mode + - (void) setRetinaMode:(BOOL)mode { self.layer.contentsScale = mode ? 2.0 : 1.0; [super setRetinaMode:mode]; @@ -2604,7 +2604,7 @@ - (void) sendEvent:(NSEvent*)event [[WineApplicationController sharedController] flipRect:&frame];
event = macdrv_create_event(WINDOW_RESTORE_REQUESTED, self); - event->window_restore_requested.keep_frame = TRUE; + event->window_restore_requested.keep_frame = true; event->window_restore_requested.frame = cgrect_win_from_mac(NSRectToCGRect(frame)); [queue postEvent:event]; macdrv_release_event(event); @@ -2725,7 +2725,7 @@ - (void) updateForGLSubviews [self checkTransparency]; }
- - (void) setRetinaMode:(int)mode + - (void) setRetinaMode:(BOOL)mode { NSRect frame; double scale = mode ? 0.5 : 2.0; @@ -3205,7 +3205,7 @@ - (void) windowWillStartLiveResize:(NSNotification *)notification [[WineApplicationController sharedController] flipRect:&frame];
event = macdrv_create_event(WINDOW_RESTORE_REQUESTED, self); - event->window_restore_requested.keep_frame = TRUE; + event->window_restore_requested.keep_frame = true; event->window_restore_requested.frame = cgrect_win_from_mac(NSRectToCGRect(frame)); [queue postEvent:event]; macdrv_release_event(event); @@ -3477,7 +3477,7 @@ void macdrv_set_cocoa_window_title(macdrv_window w, const unsigned short* title, * front. */ void macdrv_order_cocoa_window(macdrv_window w, macdrv_window p, - macdrv_window n, int activate) + macdrv_window n, bool activate) { WineWindow* window = (WineWindow*)w; WineWindow* prev = (WineWindow*)p; @@ -3657,7 +3657,7 @@ void macdrv_set_window_alpha(macdrv_window w, CGFloat alpha) /*********************************************************************** * macdrv_window_use_per_pixel_alpha */ -void macdrv_window_use_per_pixel_alpha(macdrv_window w, int use_per_pixel_alpha) +void macdrv_window_use_per_pixel_alpha(macdrv_window w, bool use_per_pixel_alpha) { @autoreleasepool { @@ -3692,7 +3692,7 @@ void macdrv_set_window_mask(macdrv_window w, CGRect rect) * orders it front and, if its frame was not within the desktop bounds, * Cocoa will typically move it on-screen. */ -void macdrv_give_cocoa_window_focus(macdrv_window w, int activate) +void macdrv_give_cocoa_window_focus(macdrv_window w, bool activate) { WineWindow* window = (WineWindow*)w;
@@ -3865,7 +3865,7 @@ void macdrv_set_view_superview(macdrv_view v, macdrv_view s, macdrv_window w, ma /*********************************************************************** * macdrv_set_view_hidden */ -void macdrv_set_view_hidden(macdrv_view v, int hidden) +void macdrv_set_view_hidden(macdrv_view v, bool hidden) { @autoreleasepool { @@ -3964,15 +3964,15 @@ void macdrv_view_release_metal_view(macdrv_metal_view v) }); }
-int macdrv_get_view_backing_size(macdrv_view v, int backing_size[2]) +bool macdrv_get_view_backing_size(macdrv_view v, int backing_size[2]) { WineContentView* view = (WineContentView*)v;
if (![view isKindOfClass:[WineContentView class]]) - return FALSE; + return false;
[view wine_getBackingSize:backing_size]; - return TRUE; + return true; }
void macdrv_set_view_backing_size(macdrv_view v, const int backing_size[2]) @@ -4032,9 +4032,9 @@ uint32_t macdrv_window_background_color(void) * processed by input sources (AKA IMEs). This is only called when there is an * active non-keyboard input source. */ -int macdrv_ime_process_key(int keyc, unsigned int flags, int repeat, void *himc) +bool macdrv_ime_process_key(int keyc, unsigned int flags, int repeat, void *himc) { - __block BOOL ret; + __block bool ret;
OnMainThread(^{ WineWindow* window = (WineWindow*)[NSApp keyWindow]; @@ -4067,10 +4067,10 @@ int macdrv_ime_process_key(int keyc, unsigned int flags, int repeat, void *himc) ret = [[[window contentView] inputContext] handleEvent:event] && !window.commandDone; } else - ret = FALSE; + ret = false; });
- return (int)ret; + return ret; }
void macdrv_clear_ime_text(void) diff --git a/dlls/winemac.drv/gdi.c b/dlls/winemac.drv/gdi.c index cfcf9990dd4..a1b91d01f0d 100644 --- a/dlls/winemac.drv/gdi.c +++ b/dlls/winemac.drv/gdi.c @@ -47,9 +47,9 @@ static CGRect desktop_rect; /* virtual desktop rectangle */ static int horz_size; /* horz. size of screen in millimeters */ static int vert_size; /* vert. size of screen in millimeters */ static int bits_per_pixel; /* pixel depth of screen */ -static int device_data_valid; /* do the above variables have up-to-date values? */ +static bool device_data_valid; /* do the above variables have up-to-date values? */
-int retina_on = FALSE; +bool retina_on = false;
static pthread_mutex_t device_data_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -141,14 +141,14 @@ static void device_init(void)
compute_desktop_rect();
- device_data_valid = TRUE; + device_data_valid = true; }
void macdrv_reset_device_metrics(void) { pthread_mutex_lock(&device_data_mutex); - device_data_valid = FALSE; + device_data_valid = false; pthread_mutex_unlock(&device_data_mutex); }
diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 22e96fa1129..ff53d5c5263 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -106,7 +106,7 @@ static inline RECT rect_from_cgrect(CGRect cgrect) macdrv_window capture_window; CFDataRef keyboard_layout_uchr; CGEventSourceKeyboardType keyboard_type; - int iso_keyboard; + bool iso_keyboard; CGEventFlags last_modifiers; UInt32 dead_key_state; HKL active_keyboard_layout; diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index d4d1dde6bda..4b4bc72401b 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -64,6 +64,7 @@ #endif
#include <pthread.h> +#include <stdbool.h>
#include "macdrv_res.h"
@@ -117,22 +118,22 @@
/* main */ -extern int macdrv_err_on; +extern bool macdrv_err_on; extern int topmost_float_inactive; -extern int capture_displays_for_fullscreen; -extern int left_option_is_alt; -extern int right_option_is_alt; -extern int left_command_is_ctrl; -extern int right_command_is_ctrl; -extern int allow_immovable_windows; -extern int use_confinement_cursor_clipping; -extern int cursor_clipping_locks_windows; -extern int use_precise_scrolling; +extern bool capture_displays_for_fullscreen; +extern bool left_option_is_alt; +extern bool right_option_is_alt; +extern bool left_command_is_ctrl; +extern bool right_command_is_ctrl; +extern bool allow_immovable_windows; +extern bool use_confinement_cursor_clipping; +extern bool cursor_clipping_locks_windows; +extern bool use_precise_scrolling; extern int gl_surface_mode; extern CFDictionaryRef localized_strings; -extern int retina_enabled; /* Whether Retina mode is enabled via registry setting. */ -extern int retina_on; /* Whether Retina mode is currently active (enabled and display is in default mode). */ -extern int enable_app_nap; +extern bool retina_enabled; /* Whether Retina mode is enabled via registry setting. */ +extern bool retina_on; /* Whether Retina mode is currently active (enabled and display is in default mode). */ +extern bool enable_app_nap;
static inline CGRect cgrect_mac_from_win(CGRect rect) { @@ -209,9 +210,9 @@ static inline CGPoint cgpoint_win_from_mac(CGPoint point) extern void macdrv_beep(void); extern void macdrv_set_application_icon(CFArrayRef images); extern void macdrv_quit_reply(int reply); -extern int macdrv_using_input_method(void); +extern bool macdrv_using_input_method(void); extern void macdrv_set_mouse_capture_window(macdrv_window window); -extern void macdrv_set_cocoa_retina_mode(int new_mode); +extern void macdrv_set_cocoa_retina_mode(bool new_mode);
/* cursor */ @@ -328,7 +329,7 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display, int reason; } app_quit_requested; struct { - int activating; + bool activating; } displays_changed; struct { unsigned int vkey; @@ -341,7 +342,7 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display, CFStringRef text; /* new text or NULL if just completing existing text */ unsigned int cursor_begin; unsigned int cursor_end; - unsigned int complete; /* is completing text? */ + bool complete; /* is completing text? */ } im_set_text; struct { CGKeyCode keycode; @@ -351,12 +352,12 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display, struct { CFDataRef uchr; CGEventSourceKeyboardType keyboard_type; - int iso_keyboard; + bool iso_keyboard; TISInputSourceRef input_source; } keyboard_changed; struct { int button; - int pressed; + bool pressed; int x; int y; unsigned long time_ms; @@ -364,7 +365,7 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display, struct { int x; int y; - int drag; + bool drag; unsigned long time_ms; } mouse_moved; struct { @@ -380,7 +381,7 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display, struct { macdrv_status_item item; int button; - int down; + bool down; int count; int x; int y; @@ -391,20 +392,20 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display, int y; } status_item_mouse_move; struct { - int no_activate; + bool no_activate; } window_drag_begin; struct { CGRect frame; - int fullscreen; - int in_resize; - int skip_size_move_loop; + bool fullscreen; + bool in_resize; + bool skip_size_move_loop; } window_frame_changed; struct { unsigned long serial; void *tried_windows; } window_got_focus; struct { - int keep_frame; + bool keep_frame; CGRect frame; } window_restore_requested; }; @@ -426,8 +427,8 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display, int refs; int type; macdrv_window window; - int status; - int done; + bool status; + bool done; union { struct { int x; @@ -506,7 +507,7 @@ extern void macdrv_set_cocoa_window_state(macdrv_window w, extern void macdrv_set_cocoa_window_title(macdrv_window w, const UniChar* title, size_t length); extern void macdrv_order_cocoa_window(macdrv_window w, macdrv_window prev, - macdrv_window next, int activate); + macdrv_window next, bool activate); extern void macdrv_hide_cocoa_window(macdrv_window w); extern void macdrv_set_cocoa_window_frame(macdrv_window w, const CGRect* new_frame); extern void macdrv_get_cocoa_window_frame(macdrv_window w, CGRect* out_frame); @@ -515,15 +516,15 @@ extern void macdrv_order_cocoa_window(macdrv_window w, macdrv_window prev, extern void macdrv_window_set_shape_image(macdrv_window w, CGImageRef image); extern void macdrv_set_window_shape(macdrv_window w, const CGRect *rects, int count); extern void macdrv_set_window_alpha(macdrv_window w, CGFloat alpha); -extern void macdrv_window_use_per_pixel_alpha(macdrv_window w, int use_per_pixel_alpha); +extern void macdrv_window_use_per_pixel_alpha(macdrv_window w, bool use_per_pixel_alpha); extern void macdrv_set_window_mask(macdrv_window w, CGRect rect); -extern void macdrv_give_cocoa_window_focus(macdrv_window w, int activate); +extern void macdrv_give_cocoa_window_focus(macdrv_window w, bool activate); extern void macdrv_set_window_min_max_sizes(macdrv_window w, CGSize min_size, CGSize max_size); extern macdrv_view macdrv_create_view(CGRect rect); extern void macdrv_dispose_view(macdrv_view v); extern void macdrv_set_view_frame(macdrv_view v, CGRect rect); extern void macdrv_set_view_superview(macdrv_view v, macdrv_view s, macdrv_window w, macdrv_view p, macdrv_view n); -extern void macdrv_set_view_hidden(macdrv_view v, int hidden); +extern void macdrv_set_view_hidden(macdrv_view v, bool hidden); extern void macdrv_add_view_opengl_context(macdrv_view v, macdrv_opengl_context c); extern void macdrv_remove_view_opengl_context(macdrv_view v, macdrv_opengl_context c); extern macdrv_metal_device macdrv_create_metal_device(void); @@ -531,18 +532,18 @@ extern void macdrv_order_cocoa_window(macdrv_window w, macdrv_window prev, extern macdrv_metal_view macdrv_view_create_metal_view(macdrv_view v, macdrv_metal_device d); extern macdrv_metal_layer macdrv_view_get_metal_layer(macdrv_metal_view v); extern void macdrv_view_release_metal_view(macdrv_metal_view v); -extern int macdrv_get_view_backing_size(macdrv_view v, int backing_size[2]); +extern bool macdrv_get_view_backing_size(macdrv_view v, int backing_size[2]); extern void macdrv_set_view_backing_size(macdrv_view v, const int backing_size[2]); extern uint32_t macdrv_window_background_color(void); -extern int macdrv_ime_process_key(int keyc, unsigned int flags, int repeat, void *data); -extern int macdrv_is_any_wine_window_visible(void); +extern bool macdrv_ime_process_key(int keyc, unsigned int flags, int repeat, void *data); +extern bool macdrv_is_any_wine_window_visible(void);
/* keyboard */ -extern void macdrv_get_input_source_info(CFDataRef* uchr,CGEventSourceKeyboardType* keyboard_type, int* is_iso, +extern void macdrv_get_input_source_info(CFDataRef* uchr,CGEventSourceKeyboardType* keyboard_type, bool* is_iso, TISInputSourceRef* input_source); extern CFArrayRef macdrv_create_input_source_list(void); -extern int macdrv_select_input_source(TISInputSourceRef input_source); +extern bool macdrv_select_input_source(TISInputSourceRef input_source); extern const CFStringRef macdrv_input_source_input_key; extern const CFStringRef macdrv_input_source_type_key; extern const CFStringRef macdrv_input_source_lang_key; @@ -552,8 +553,8 @@ extern void macdrv_get_input_source_info(CFDataRef* uchr,CGEventSourceKeyboardTy /* clipboard */ extern CFArrayRef macdrv_copy_pasteboard_types(CFTypeRef pasteboard); extern CFDataRef macdrv_copy_pasteboard_data(CFTypeRef pasteboard, CFStringRef type); -extern int macdrv_is_pasteboard_owner(macdrv_window w); -extern int macdrv_has_pasteboard_changed(void); +extern bool macdrv_is_pasteboard_owner(macdrv_window w); +extern bool macdrv_has_pasteboard_changed(void); extern void macdrv_clear_pasteboard(macdrv_window w); extern int macdrv_set_pasteboard_data(CFStringRef type, CFDataRef data, macdrv_window w);
diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c index 20295d1c6ee..ed913834255 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c @@ -43,21 +43,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(macdrv); C_ASSERT(NUM_EVENT_TYPES <= sizeof(macdrv_event_mask) * 8);
int topmost_float_inactive = TOPMOST_FLOAT_INACTIVE_NONFULLSCREEN; -int capture_displays_for_fullscreen = 0; +bool capture_displays_for_fullscreen = false; BOOL allow_vsync = TRUE; BOOL allow_set_gamma = TRUE; -int left_option_is_alt = 0; -int right_option_is_alt = 0; -int left_command_is_ctrl = 0; -int right_command_is_ctrl = 0; +bool left_option_is_alt = false; +bool right_option_is_alt = false; +bool left_command_is_ctrl = false; +bool right_command_is_ctrl = false; BOOL allow_software_rendering = FALSE; -int allow_immovable_windows = TRUE; -int use_confinement_cursor_clipping = TRUE; -int cursor_clipping_locks_windows = TRUE; -int use_precise_scrolling = TRUE; +bool allow_immovable_windows = true; +bool use_confinement_cursor_clipping = true; +bool cursor_clipping_locks_windows = true; +bool use_precise_scrolling = true; int gl_surface_mode = GL_SURFACE_IN_FRONT_OPAQUE; -int retina_enabled = FALSE; -int enable_app_nap = FALSE; +bool retina_enabled = false; +bool enable_app_nap = false;
UINT64 app_icon_callback = 0; UINT64 app_quit_request_callback = 0; diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 522b61d844d..ae6695f93ca 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -1733,7 +1733,7 @@ void macdrv_window_frame_changed(HWND hwnd, const macdrv_event *event) flags |= SWP_NOSENDCHANGING; if (!(flags & SWP_NOSIZE) || !(flags & SWP_NOMOVE)) { - int send_sizemove = !event->window_frame_changed.in_resize && !being_dragged && !event->window_frame_changed.skip_size_move_loop; + bool send_sizemove = !event->window_frame_changed.in_resize && !being_dragged && !event->window_frame_changed.skip_size_move_loop; if (send_sizemove) send_message(hwnd, WM_ENTERSIZEMOVE, 0, 0); NtUserSetRawWindowPos(hwnd, rect, flags, FALSE);
On Fri Nov 7 20:03:16 2025 +0000, Brendan Shanks wrote:
changed this line in [version 2 of the diff](/wine/wine/-/merge_requests/9400/diffs?diff_id=222034&start_sha=e6b31bc32e974c9a284b8c4d566a3d8c39eac17c#26a836dd7e6ad8a25597cbc502737a655c43f67c_50_50)
Ah yes, thanks!
This merge request was approved by Marc-Aurel Zent.
If C99 `bool`s are fine in and of themselves, then this looks good to me.