From: Brendan Shanks bshanks@codeweavers.com
Wine's logging functions now work from a non-Wine thread and are usable from ObjC. --- dlls/winemac.drv/cocoa_app.h | 2 -- dlls/winemac.drv/cocoa_app.m | 27 --------------------------- dlls/winemac.drv/cocoa_clipboard.m | 8 ++++---- dlls/winemac.drv/cocoa_event.m | 6 +++--- dlls/winemac.drv/cocoa_window.m | 2 +- dlls/winemac.drv/macdrv.h | 5 ----- dlls/winemac.drv/macdrv_cocoa.h | 3 --- dlls/winemac.drv/macdrv_main.c | 1 - 8 files changed, 8 insertions(+), 46 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_app.h b/dlls/winemac.drv/cocoa_app.h index 47468837218..2c65dff5aa9 100644 --- a/dlls/winemac.drv/cocoa_app.h +++ b/dlls/winemac.drv/cocoa_app.h @@ -22,8 +22,6 @@
#include "macdrv_cocoa.h"
-#define ERR(...) do { if (macdrv_err_on) LogError(__func__, __VA_ARGS__); } while (false) -
enum { WineApplicationEventWakeQuery, diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index 970065dee6b..4dafa5badcc 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -44,9 +44,6 @@ static NSString* const WineActivatingAppConfigDirKey = @"ActivatingAppConfigDir";
-bool macdrv_err_on; - - #if !defined(MAC_OS_VERSION_14_0) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_14_0 @interface NSApplication (CooperativeActivationSelectorsForOldSDKs)
@@ -2357,30 +2354,6 @@ void OnMainThreadAsync(dispatch_block_t block)
@end
-/*********************************************************************** - * LogError - */ -void LogError(const char* func, const char* format, ...) -{ - va_list args; - va_start(args, format); - LogErrorv(func, format, args); - va_end(args); -} - -/*********************************************************************** - * LogErrorv - */ -void LogErrorv(const char* func, const char* format, va_list args) -{ -@autoreleasepool -{ - NSString* message = [[NSString alloc] initWithFormat:[NSString stringWithUTF8String:format] arguments:args]; - fprintf(stderr, "err:%s:%s", func, [message UTF8String]); - [message release]; -} -} - /*********************************************************************** * macdrv_window_rejected_focus * diff --git a/dlls/winemac.drv/cocoa_clipboard.m b/dlls/winemac.drv/cocoa_clipboard.m index 0d305f85bdf..de0f6dc768c 100644 --- a/dlls/winemac.drv/cocoa_clipboard.m +++ b/dlls/winemac.drv/cocoa_clipboard.m @@ -136,7 +136,7 @@ CFArrayRef macdrv_copy_pasteboard_types(CFTypeRef pasteboard) } @catch (id e) { - ERR("Exception discarded while copying pasteboard types: %@\n", e); + ERR("Exception discarded while copying pasteboard types: %s\n", debugstr_cf(e)); } });
@@ -179,7 +179,7 @@ CFDataRef macdrv_copy_pasteboard_data(CFTypeRef pasteboard, CFStringRef type) } @catch (id e) { - ERR("Exception discarded while copying pasteboard types: %@\n", e); + ERR("Exception discarded while copying pasteboard types: %s\n", debugstr_cf(e)); } });
@@ -207,7 +207,7 @@ void macdrv_clear_pasteboard(macdrv_window w) } @catch (id e) { - ERR("Exception discarded while clearing pasteboard: %@\n", e); + ERR("Exception discarded while clearing pasteboard: %s\n", debugstr_cf(e)); } }); } @@ -244,7 +244,7 @@ bool macdrv_set_pasteboard_data(CFStringRef type, CFDataRef data, macdrv_window } @catch (id e) { - ERR("Exception discarded while copying pasteboard types: %@\n", e); + ERR("Exception discarded while copying pasteboard types: %s\n", debugstr_cf(e)); } });
diff --git a/dlls/winemac.drv/cocoa_event.m b/dlls/winemac.drv/cocoa_event.m index cd6ae77963f..855f5138cc3 100644 --- a/dlls/winemac.drv/cocoa_event.m +++ b/dlls/winemac.drv/cocoa_event.m @@ -194,7 +194,7 @@ - (void) signalEventAvailable } while (rc < 0 && errno == EINTR);
if (rc < 0 && errno != EAGAIN) - ERR("%@: got error writing to event queue signaling pipe: %s\n", self, strerror(errno)); + ERR("%s: got error writing to event queue signaling pipe: %s\n", debugstr_cf(self), strerror(errno)); }
- (void) postEventObject:(MacDrvEvent*)event @@ -263,9 +263,9 @@ - (MacDrvEvent*) getEventMatchingMask:(macdrv_event_mask)mask if (rc == 0 || (rc < 0 && errno != EAGAIN)) { if (rc == 0) - ERR("%@: event queue signaling pipe unexpectedly closed\n", self); + ERR("%s: event queue signaling pipe unexpectedly closed\n", debugstr_cf(self)); else - ERR("%@: got error reading from event queue signaling pipe: %s\n", self, strerror(errno)); + ERR("%s: got error reading from event queue signaling pipe: %s\n", debugstr_cf(self), strerror(errno)); return nil; }
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index a238da52380..52ca61653c6 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -1543,7 +1543,7 @@ - (BOOL) becameEligibleParentOrChild reordered = TRUE; } else - ERR("shouldn't happen: %@ thinks %@ is a latent child, but it doesn't agree\n", self, child); + ERR("shouldn't happen: %s thinks %s is a latent child, but it doesn't agree\n", debugstr_cf(self), debugstr_cf(child)); [indexesToRemove addIndex:i]; } } diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index 3bd9c3526ba..255e45cc3f3 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -77,11 +77,6 @@ #include <OpenGL/glu.h> #include <OpenGL/CGLRenderers.h>
-#ifdef __OBJC__ -#undef ERR -#define ERR(...) do { if (macdrv_err_on) LogError(__func__, __VA_ARGS__); } while (false) -#endif -
extern bool allow_vsync; extern bool allow_set_gamma; diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index cae31eea616..f59fdcc861e 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -112,7 +112,6 @@
/* main */ -extern bool macdrv_err_on; extern int topmost_float_inactive; extern bool capture_displays_for_fullscreen; extern bool left_option_is_alt; @@ -208,8 +207,6 @@ static inline CGPoint cgpoint_win_from_mac(CGPoint point) extern void macdrv_set_mouse_capture_window(macdrv_window window); extern void macdrv_set_cocoa_retina_mode(bool new_mode);
-extern void LogError(const char* func, const char* format, ...); -extern void LogErrorv(const char* func, const char* format, va_list args);
/* cursor */ extern void macdrv_set_cursor(CFStringRef name, CFArrayRef frames); diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c index 9061fb1aae5..add9d015f6a 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c @@ -435,7 +435,6 @@ static NTSTATUS macdrv_init(void *arg) setup_options(); load_strings(params->strings);
- macdrv_err_on = ERR_ON(macdrv); if (macdrv_start_cocoa_app(NtGetTickCount())) { ERR("Failed to start Cocoa app main loop\n");