Changeset 19852

Show
Ignore:
Timestamp:
03/03/07 18:59:38 (2 years ago)
Author:
patrick
Message:

Added a data member mScreen that serves as an index into the array of
NSScreen objects. The code for setting the value based on the display_system
config elmeent was already in place, but it is commented out pending a
change to that config element that makes it less specific to the X Window
System. For now, it will only be possible to open Cocoa windows on the main
screen (as it was before this change).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • juggler/trunk/modules/gadgeteer/gadget/Devices/KeyboardMouseDevice/InputWindowCocoa.h

    r19828 r19852  
    133133   void finishOpen(); 
    134134 
     135   unsigned int mScreen; 
    135136   bool mWindowOpen;    /**< Keeps track of NSWindow open/closed state */ 
    136137}; 
  • juggler/trunk/modules/gadgeteer/gadget/Devices/KeyboardMouseDevice/InputWindowCocoa.mm

    r19843 r19852  
    3535#import <AppKit/NSWindow.h> 
    3636#import <AppKit/NSApplication.h> 
     37#import <AppKit/NSScreen.h> 
    3738 
    3839#include <vpr/vpr.h> 
     
    116117   : gadget::InputAreaCocoa() 
    117118   , gadget::Input() 
     119   , mScreen(0) 
    118120   , mWindowOpen(false) 
    119121{ 
     
    198200      mScreen = disp_sys_elt->getProperty<unsigned int>("pipes", screen_num); 
    199201 
     202      NSArray* screens = [NSArray screens]; 
     203      if ( mScreen >= [screens count] ) 
     204      { 
     205         mScreen = 0; 
     206      } 
     207 
    200208      vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_CONFIG_LVL) 
    201209         << "[gadget::InputWindowCocoa] Screen: " << mXDisplayString 
     
    237245 
    238246      NSRect content_rect = { {mX, mY}, {mWidth, mHeight} }; 
     247 
     248      // mScreen is already known to be a valid index. 
     249      NSScreen* screen = [[NSScreen screens] objectAtIndex:mScreen]; 
     250 
    239251      // Creating the window and its view does not open the window. That 
    240252      // happens when the -setContentView: message is delivered to 
    241       // mCocoaWindow in waitAndOpen(). 
     253      // mCocoaWindow in finishOpen(). 
    242254      mCocoaWindow = 
    243255         [[NSWindow alloc] initWithContentRect:content_rect 
    244256                                     styleMask:style_mask 
    245257                                       backing:NSBackingStoreBuffered 
    246                                          defer:NO]; 
     258                                         defer:NO 
     259                                        screen:screen]; 
    247260 
    248261      // Register an observer for NSWindowWillCloseNotification events coming