~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to intern/ghost/intern/GHOST_SystemCocoa.mm

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-02-19 11:24:23 UTC
  • mfrom: (14.2.23 sid)
  • Revision ID: package-import@ubuntu.com-20140219112423-rkmaz2m7ha06d4tk
Tags: 2.69-3ubuntu1
* Merge with Debian; remaining changes:
  - Configure without OpenImageIO on armhf, as it is not available on
    Ubuntu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
#include "GHOST_WindowCocoa.h"
52
52
#ifdef WITH_INPUT_NDOF
53
53
#include "GHOST_NDOFManagerCocoa.h"
 
54
#include "GHOST_NDOFManager3Dconnexion.h"
54
55
#endif
55
56
 
56
57
#include "AssertMacros.h"
1017
1018
//Note: called from NSWindow delegate
1018
1019
GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType, GHOST_WindowCocoa* window)
1019
1020
{
 
1021
        NSArray *windowsList;
 
1022
        windowsList = [NSApp orderedWindows];
1020
1023
        if (!validWindow(window)) {
1021
1024
                return GHOST_kFailure;
1022
1025
        }
1023
1026
                switch (eventType) {
1024
1027
                        case GHOST_kEventWindowClose:
1025
 
                                pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window) );
 
1028
                                // check for index of mainwindow as it would quit blender without dialog and discard
 
1029
                                if ([windowsList count] > 1  && window->getCocoaWindow() != [windowsList objectAtIndex:[windowsList count] - 1]) {
 
1030
                                        pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowClose, window) );
 
1031
                                }
 
1032
                                else {
 
1033
                                        handleQuitRequest(); // -> quit dialog
 
1034
                                }
1026
1035
                                break;
1027
1036
                        case GHOST_kEventWindowActivate:
1028
1037
                                m_windowManager->setActiveWindow(window);
1540
1549
                                                
1541
1550
                                                window->clientToScreenIntern(x_warp+x_accum, y_warp+y_accum, x, y);
1542
1551
                                                pushEvent(new GHOST_EventCursor([event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
 
1552
                                                break;
1543
1553
                                        }
1544
 
                                                break;
1545
1554
                                        case GHOST_kGrabWrap: //Wrap cursor at area/window boundaries
1546
1555
                                        {
1547
1556
                                                NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream];
1551
1560
                                                GHOST_Rect bounds, windowBounds, correctedBounds;
1552
1561
                                                
1553
1562
                                                /* fallback to window bounds */
1554
 
                                                if(window->getCursorGrabBounds(bounds)==GHOST_kFailure)
 
1563
                                                if (window->getCursorGrabBounds(bounds) == GHOST_kFailure)
1555
1564
                                                        window->getClientBounds(bounds);
1556
1565
                                                
1557
1566
                                                //Switch back to Cocoa coordinates orientation (y=0 at botton,the same as blender internal btw!), and to client coordinates
1585
1594
                                                window->getCursorGrabInitPos(x_cur, y_cur);
1586
1595
                                                window->clientToScreenIntern(x_cur + x_accum, y_cur + y_accum, x, y);
1587
1596
                                                pushEvent(new GHOST_EventCursor([event timestamp] * 1000, GHOST_kEventCursorMove, window, x, y));
 
1597
                                                break;
1588
1598
                                        }
1589
 
                                                break;
1590
1599
                                        default:
1591
1600
                                        {
1592
1601
                                                //Normal cursor operation: send mouse position in window
1598
1607
 
1599
1608
                                                m_cursorDelta_x=0;
1600
1609
                                                m_cursorDelta_y=0; //Mouse motion occurred between two cursor warps, so we can reset the delta counter
 
1610
                                                break;
1601
1611
                                        }
1602
 
                                                break;
1603
1612
                                }
1604
1613
                        }
1605
1614
                        break;
1762
1771
                        if ((keyCode > 266) && (keyCode < 271))
1763
1772
                                utf8_buf[0] = '\0';
1764
1773
 
 
1774
                        /* no text with command key pressed */
 
1775
                        if (m_modifierMask & NSCommandKeyMask)
 
1776
                                utf8_buf[0] = '\0';
 
1777
 
1765
1778
                        if ((keyCode == GHOST_kKeyQ) && (m_modifierMask & NSCommandKeyMask))
1766
1779
                                break; //Cmd-Q is directly handled by Cocoa
1767
1780
 
1853
1866
        
1854
1867
        [pool drain];
1855
1868
 
1856
 
        if(temp_buff) {
 
1869
        if (temp_buff) {
1857
1870
                return temp_buff;
1858
1871
        }
1859
1872
        else {
1865
1878
{
1866
1879
        NSString *textToCopy;
1867
1880
        
1868
 
        if(selection) {return;} // for copying the selection, used on X11
 
1881
        if (selection) return;  // for copying the selection, used on X11
1869
1882
 
1870
1883
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
1871
1884