summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean.guyomarch@openwide.fr>2015-10-14 09:32:20 +0200
committerNicolas Aguirre <aguirre.nicolas@gmail.com>2015-11-10 08:32:49 +0100
commit18a1c202ccaba07aaa21fecd0fcf886a365393c6 (patch)
treeb78553d8b9bdad8594b6ab9afbbdb8399df1e8b3
parent8bbdb2511e150d3d1672de640d7565d9e21baa6d (diff)
ecore_cocoa: reindent file
-rw-r--r--src/lib/ecore_cocoa/ecore_cocoa_window.m252
1 files changed, 126 insertions, 126 deletions
diff --git a/src/lib/ecore_cocoa/ecore_cocoa_window.m b/src/lib/ecore_cocoa/ecore_cocoa_window.m
index cf04da456e..af07e70b98 100644
--- a/src/lib/ecore_cocoa/ecore_cocoa_window.m
+++ b/src/lib/ecore_cocoa/ecore_cocoa_window.m
@@ -22,19 +22,19 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
22 backing: (NSBackingStoreType) bufferingType 22 backing: (NSBackingStoreType) bufferingType
23 defer: (BOOL) flag 23 defer: (BOOL) flag
24{ 24{
25 if (![super initWithContentRect: contentRect 25 if (![super initWithContentRect: contentRect
26 styleMask: aStyle 26 styleMask: aStyle
27 backing: bufferingType 27 backing: bufferingType
28 defer: flag]) return nil; 28 defer: flag]) return nil;
29 29
30 [self setBackgroundColor: [NSColor whiteColor]]; 30 [self setBackgroundColor: [NSColor whiteColor]];
31 [self makeKeyWindow]; 31 [self makeKeyWindow];
32 [self setDelegate:self]; 32 [self setDelegate:self];
33 [self setAcceptsMouseMovedEvents:YES]; 33 [self setAcceptsMouseMovedEvents:YES];
34 34
35 [self setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; 35 [self setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
36 36
37 return self; 37 return self;
38} 38}
39 39
40- (BOOL)isFullScreen 40- (BOOL)isFullScreen
@@ -49,7 +49,7 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
49 49
50- (BOOL)canBecomeKeyWindow 50- (BOOL)canBecomeKeyWindow
51{ 51{
52 return YES; 52 return YES;
53} 53}
54 54
55- (void)windowWillClose:(NSNotification *) notification 55- (void)windowWillClose:(NSNotification *) notification
@@ -87,30 +87,30 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
87 87
88- (void)windowDidBecomeKey:(NSNotification *)notification 88- (void)windowDidBecomeKey:(NSNotification *)notification
89{ 89{
90 Ecore_Cocoa_Event_Window *e; 90 Ecore_Cocoa_Event_Window *e;
91 91
92 e = malloc(sizeof(*e)); 92 e = malloc(sizeof(*e));
93 if (EINA_UNLIKELY(e == NULL)) 93 if (EINA_UNLIKELY(e == NULL))
94 { 94 {
95 CRI("Failed to allocate Ecore_Cocoa_Event_Window"); 95 CRI("Failed to allocate Ecore_Cocoa_Event_Window");
96 return; 96 return;
97 } 97 }
98 e->wid = [notification object]; 98 e->wid = [notification object];
99 ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, e, NULL, NULL); 99 ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, e, NULL, NULL);
100} 100}
101 101
102- (void)windowDidResignKey:(NSNotification *)notification 102- (void)windowDidResignKey:(NSNotification *)notification
103{ 103{
104 Ecore_Cocoa_Event_Window *e; 104 Ecore_Cocoa_Event_Window *e;
105 105
106 e = malloc(sizeof(*e)); 106 e = malloc(sizeof(*e));
107 if (EINA_UNLIKELY(e == NULL)) 107 if (EINA_UNLIKELY(e == NULL))
108 { 108 {
109 CRI("Failed to allocate Ecore_Cocoa_Event_Window"); 109 CRI("Failed to allocate Ecore_Cocoa_Event_Window");
110 return; 110 return;
111 } 111 }
112 e->wid = [notification object]; 112 e->wid = [notification object];
113 ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, e, NULL, NULL); 113 ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, e, NULL, NULL);
114} 114}
115 115
116- (void) mouseDown:(NSEvent*) event 116- (void) mouseDown:(NSEvent*) event
@@ -169,12 +169,12 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
169 169
170- (void) rightMouseDown:(NSEvent*) event 170- (void) rightMouseDown:(NSEvent*) event
171{ 171{
172 [self mouseDown: event]; 172 [self mouseDown: event];
173} 173}
174 174
175- (void) otherMouseDown:(NSEvent*) event 175- (void) otherMouseDown:(NSEvent*) event
176{ 176{
177 [self mouseDown: event]; 177 [self mouseDown: event];
178} 178}
179 179
180- (void) mouseUp:(NSEvent*) event 180- (void) mouseUp:(NSEvent*) event
@@ -226,12 +226,12 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
226 226
227- (void) rightMouseUp:(NSEvent*) event 227- (void) rightMouseUp:(NSEvent*) event
228{ 228{
229 [self mouseUp: event]; 229 [self mouseUp: event];
230} 230}
231 231
232- (void) otherMouseUp:(NSEvent*) event 232- (void) otherMouseUp:(NSEvent*) event
233{ 233{
234 [self mouseUp: event]; 234 [self mouseUp: event];
235} 235}
236 236
237- (void) mouseMoved:(NSEvent*) event 237- (void) mouseMoved:(NSEvent*) event
@@ -269,56 +269,56 @@ static NSCursor *_cursors[__ECORE_COCOA_CURSOR_LAST];
269 269
270EAPI Ecore_Cocoa_Window * 270EAPI Ecore_Cocoa_Window *
271ecore_cocoa_window_new(int x, 271ecore_cocoa_window_new(int x,
272 int y, 272 int y,
273 int width, 273 int width,
274 int height) 274 int height)
275{ 275{
276 Ecore_Cocoa_Window *w; 276 Ecore_Cocoa_Window *w;
277 277
278 EcoreCocoaWindow *window = [[EcoreCocoaWindow alloc] initWithContentRect:NSMakeRect(x, y, width, height) 278 EcoreCocoaWindow *window = [[EcoreCocoaWindow alloc] initWithContentRect:NSMakeRect(x, y, width, height)
279 styleMask:(NSTitledWindowMask | 279 styleMask:(NSTitledWindowMask |
280 NSClosableWindowMask | 280 NSClosableWindowMask |
281 NSResizableWindowMask | 281 NSResizableWindowMask |
282 NSMiniaturizableWindowMask) 282 NSMiniaturizableWindowMask)
283 backing:NSBackingStoreBuffered 283 backing:NSBackingStoreBuffered
284 defer:NO]; 284 defer:NO];
285 285
286 if (EINA_UNLIKELY(!window)) 286 if (EINA_UNLIKELY(!window))
287 { 287 {
288 CRI("Failed to create EcoreCocoaWindow"); 288 CRI("Failed to create EcoreCocoaWindow");
289 return NULL; 289 return NULL;
290 } 290 }
291 291
292 //Set the process to be a foreground process, 292 //Set the process to be a foreground process,
293 //without that it prevents the window to become the key window and 293 //without that it prevents the window to become the key window and
294 //receive all mouse mouve events. 294 //receive all mouse mouve events.
295 [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; 295 [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
296 [NSApp activateIgnoringOtherApps:YES]; 296 [NSApp activateIgnoringOtherApps:YES];
297 297
298 298
299 w = calloc(1, sizeof(Ecore_Cocoa_Window)); 299 w = calloc(1, sizeof(Ecore_Cocoa_Window));
300 if (EINA_UNLIKELY(w == NULL)) 300 if (EINA_UNLIKELY(w == NULL))
301 { 301 {
302 CRI("Failed to allocate Ecore_Cocoa_Window"); 302 CRI("Failed to allocate Ecore_Cocoa_Window");
303 [window release]; 303 [window release];
304 return NULL; 304 return NULL;
305 } 305 }
306 w->window = window; 306 w->window = window;
307 w->borderless = 0; 307 w->borderless = 0;
308 308
309 window.ecore_window_data = w; 309 window.ecore_window_data = w;
310 310
311 return w; 311 return w;
312} 312}
313 313
314EAPI void 314EAPI void
315ecore_cocoa_window_free(Ecore_Cocoa_Window *window) 315ecore_cocoa_window_free(Ecore_Cocoa_Window *window)
316{ 316{
317 if (!window) 317 if (!window)
318 return; 318 return;
319 319
320 [window->window release]; 320 [window->window release];
321 free(window); 321 free(window);
322} 322}
323 323
324EAPI void 324EAPI void
@@ -328,8 +328,8 @@ ecore_cocoa_window_size_min_set(Ecore_Cocoa_Window *window,
328{ 328{
329 EINA_SAFETY_ON_NULL_RETURN(window); 329 EINA_SAFETY_ON_NULL_RETURN(window);
330 330
331 NSSize size = {w,h}; 331 NSSize size = {w,h};
332 window->window.contentMinSize = size; 332 window->window.contentMinSize = size;
333} 333}
334 334
335EAPI void 335EAPI void
@@ -339,8 +339,8 @@ ecore_cocoa_window_size_max_set(Ecore_Cocoa_Window *window,
339{ 339{
340 EINA_SAFETY_ON_NULL_RETURN(window); 340 EINA_SAFETY_ON_NULL_RETURN(window);
341 341
342 NSSize size = {w,h}; 342 NSSize size = {w,h};
343 window->window.contentMaxSize = size; 343 window->window.contentMaxSize = size;
344} 344}
345 345
346EAPI void 346EAPI void
@@ -350,62 +350,62 @@ ecore_cocoa_window_size_step_set(Ecore_Cocoa_Window *window,
350{ 350{
351 EINA_SAFETY_ON_NULL_RETURN(window); 351 EINA_SAFETY_ON_NULL_RETURN(window);
352 352
353 NSSize size = {w,h}; 353 NSSize size = {w,h};
354 window->window.contentResizeIncrements = size; 354 window->window.contentResizeIncrements = size;
355} 355}
356 356
357EAPI void 357EAPI void
358ecore_cocoa_window_move(Ecore_Cocoa_Window *window, 358ecore_cocoa_window_move(Ecore_Cocoa_Window *window,
359 int x, 359 int x,
360 int y) 360 int y)
361{ 361{
362 EINA_SAFETY_ON_NULL_RETURN(window); 362 EINA_SAFETY_ON_NULL_RETURN(window);
363 363
364 NSRect win_frame; 364 NSRect win_frame;
365 365
366 win_frame = [window->window frame]; 366 win_frame = [window->window frame];
367 win_frame.origin.x = x; 367 win_frame.origin.x = x;
368 win_frame.origin.y = y; 368 win_frame.origin.y = y;
369 369
370 [window->window setFrame:win_frame display:YES]; 370 [window->window setFrame:win_frame display:YES];
371} 371}
372 372
373EAPI void 373EAPI void
374ecore_cocoa_window_resize(Ecore_Cocoa_Window *window, 374ecore_cocoa_window_resize(Ecore_Cocoa_Window *window,
375 int width, 375 int width,
376 int height) 376 int height)
377{ 377{
378 EINA_SAFETY_ON_NULL_RETURN(window); 378 EINA_SAFETY_ON_NULL_RETURN(window);
379 379
380 NSRect win_frame; 380 NSRect win_frame;
381 381
382 win_frame = [window->window frame]; 382 win_frame = [window->window frame];
383 win_frame.size.height = height + 383 win_frame.size.height = height +
384 (([window->window isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get()); 384 (([window->window isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get());
385 win_frame.size.width = width; 385 win_frame.size.width = width;
386 386
387 [window->window setFrame:win_frame display:YES]; 387 [window->window setFrame:win_frame display:YES];
388} 388}
389 389
390EAPI void 390EAPI void
391ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window, 391ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window,
392 int x, 392 int x,
393 int y, 393 int y,
394 int width, 394 int width,
395 int height) 395 int height)
396{ 396{
397 EINA_SAFETY_ON_NULL_RETURN(window); 397 EINA_SAFETY_ON_NULL_RETURN(window);
398 398
399 NSRect win_frame; 399 NSRect win_frame;
400 400
401 win_frame = [window->window frame]; 401 win_frame = [window->window frame];
402 win_frame.size.height = height + 402 win_frame.size.height = height +
403 (([window->window isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get()); 403 (([window->window isFullScreen] == YES) ? 0 : ecore_cocoa_titlebar_height_get());
404 win_frame.size.width = width; 404 win_frame.size.width = width;
405 win_frame.origin.x = x; 405 win_frame.origin.x = x;
406 win_frame.origin.y = y; 406 win_frame.origin.y = y;
407 407
408 [window->window setFrame:win_frame display:YES]; 408 [window->window setFrame:win_frame display:YES];
409} 409}
410 410
411EAPI void 411EAPI void
@@ -414,7 +414,7 @@ ecore_cocoa_window_title_set(Ecore_Cocoa_Window *window, const char *title)
414 EINA_SAFETY_ON_NULL_RETURN(window); 414 EINA_SAFETY_ON_NULL_RETURN(window);
415 EINA_SAFETY_ON_NULL_RETURN(title); 415 EINA_SAFETY_ON_NULL_RETURN(title);
416 416
417 [window->window setTitle:[NSString stringWithUTF8String:title]]; 417 [window->window setTitle:[NSString stringWithUTF8String:title]];
418} 418}
419 419
420EAPI void 420EAPI void
@@ -422,8 +422,8 @@ ecore_cocoa_window_show(Ecore_Cocoa_Window *window)
422{ 422{
423 EINA_SAFETY_ON_NULL_RETURN(window); 423 EINA_SAFETY_ON_NULL_RETURN(window);
424 424
425 if (![window->window isVisible]) 425 if (![window->window isVisible])
426 [window->window makeKeyAndOrderFront:NSApp]; 426 [window->window makeKeyAndOrderFront:NSApp];
427} 427}
428 428
429EAPI void 429EAPI void
@@ -431,15 +431,15 @@ ecore_cocoa_window_hide(Ecore_Cocoa_Window *window)
431{ 431{
432 EINA_SAFETY_ON_NULL_RETURN(window); 432 EINA_SAFETY_ON_NULL_RETURN(window);
433 433
434 if (![window->window isVisible]) 434 if (![window->window isVisible])
435 [window->window orderOut:NSApp]; 435 [window->window orderOut:NSApp];
436} 436}
437 437
438EAPI void 438EAPI void
439ecore_cocoa_window_raise(Ecore_Cocoa_Window *window) 439ecore_cocoa_window_raise(Ecore_Cocoa_Window *window)
440{ 440{
441 EINA_SAFETY_ON_NULL_RETURN(window); 441 EINA_SAFETY_ON_NULL_RETURN(window);
442 [window->window orderFront:nil]; 442 [window->window orderFront:nil];
443} 443}
444 444
445EAPI void 445EAPI void
@@ -478,31 +478,31 @@ ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window,
478{ 478{
479 EINA_SAFETY_ON_NULL_RETURN(window); 479 EINA_SAFETY_ON_NULL_RETURN(window);
480 480
481 if (on) 481 if (on)
482 [window->window setContentBorderThickness:0.0 482 [window->window setContentBorderThickness:0.0
483 forEdge:NSMinXEdge | NSMinYEdge | NSMaxXEdge | NSMaxYEdge]; 483 forEdge:NSMinXEdge | NSMinYEdge | NSMaxXEdge | NSMaxYEdge];
484} 484}
485 485
486EAPI void 486EAPI void
487ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window, 487ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window,
488 void *view) 488 void *view)
489{ 489{
490 EINA_SAFETY_ON_NULL_RETURN(window); 490 EINA_SAFETY_ON_NULL_RETURN(window);
491 EINA_SAFETY_ON_NULL_RETURN(view); 491 EINA_SAFETY_ON_NULL_RETURN(view);
492 492
493 //[[window->window contentView] addSubview:view]; 493 //[[window->window contentView] addSubview:view];
494 NSView *v = view; 494 NSView *v = view;
495 [window->window setContentView:view]; 495 [window->window setContentView:view];
496 496
497 NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect:[v frame] 497 NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect:[v frame]
498 options:NSTrackingMouseMoved | 498 options:NSTrackingMouseMoved |
499 NSTrackingActiveInActiveApp | 499 NSTrackingActiveInActiveApp |
500 NSTrackingInVisibleRect 500 NSTrackingInVisibleRect
501 owner:v 501 owner:v
502 userInfo:nil]; 502 userInfo:nil];
503 [v addTrackingArea:area]; 503 [v addTrackingArea:area];
504 504
505 [area release]; 505 [area release];
506} 506}
507 507
508EAPI Ecore_Cocoa_Window_Id 508EAPI Ecore_Cocoa_Window_Id
@@ -510,9 +510,9 @@ ecore_cocoa_window_get_window_id(const Ecore_Cocoa_Window *window)
510{ 510{
511 EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL); 511 EINA_SAFETY_ON_NULL_RETURN_VAL(window, NULL);
512 512
513 DBG("Return : %p", window->window); 513 DBG("Return : %p", window->window);
514 514
515 return window->window; 515 return window->window;
516} 516}
517 517
518EAPI void 518EAPI void