ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/clip_macosx.cpp
(Generate patch)

Comparing BasiliskII/src/MacOSX/clip_macosx.cpp (file contents):
Revision 1.4 by gbeauche, 2005-01-30T21:42:13Z vs.
Revision 1.5 by gbeauche, 2006-03-21T06:43:02Z

# Line 69 | Line 69 | void GetScrap(void **handle, uint32 type
69          Size byteCount;
70          if (GetScrapFlavorSize(theScrap, type, &byteCount) == noErr) {
71  
72 <          // Get the native clipboard data
73 <          uint8 *data = new uint8[byteCount];
74 <          if (GetScrapFlavorData(theScrap, type, &byteCount, data) == noErr) {
75 <                  M68kRegisters r;
76 <
77 <                  // Add new data to clipboard
78 <                  static uint16 proc[] = {
79 <                          0x598f,                               // subq.l               #4,sp
80 <                          0xa9fc,                               // ZeroScrap()
81 <                          0x2f3c, 0, 0,                 // move.l               #length,-(sp)
82 <                          0x2f3c, 0, 0,                 // move.l               #type,-(sp)
83 <                          0x2f3c, 0, 0,                 // move.l               #outbuf,-(sp)
84 <                          0xa9fe,                               // PutScrap()
85 <                          0x588f,                               // addq.l               #4,sp
86 <                          M68K_RTS
87 <                  };
88 <                  uint32 proc_area = (uint32)proc;
89 <                  WriteMacInt32(proc_area +  6, byteCount);
90 <                  WriteMacInt32(proc_area + 12, type);
91 <                  WriteMacInt32(proc_area + 18, (uint32)data);
92 <                  we_put_this_data = true;
93 <                  Execute68k(proc_area, &r);
94 <          }
72 >                // Allocate space for new scrap in MacOS side
73 >                M68kRegisters r;
74 >                r.d[0] = byteCount;
75 >                Execute68kTrap(0xa71e, &r);                             // NewPtrSysClear()
76 >                uint32 scrap_area = r.a[0];
77  
78 <          delete[] data;
78 >                // Get the native clipboard data
79 >                if (scrap_area) {
80 >                        uint8 * const data = Mac2HostAddr(scrap_area);
81 >                        if (GetScrapFlavorData(theScrap, type, &byteCount, data) == noErr) {
82 >
83 >                                // Add new data to clipboard
84 >                                static uint8 proc[] = {
85 >                                        0x59, 0x8f,                                     // subq.l       #4,sp
86 >                                        0xa9, 0xfc,                                     // ZeroScrap()
87 >                                        0x2f, 0x3c, 0, 0, 0, 0,         // move.l       #length,-(sp)
88 >                                        0x2f, 0x3c, 0, 0, 0, 0,         // move.l       #type,-(sp)
89 >                                        0x2f, 0x3c, 0, 0, 0, 0,         // move.l       #outbuf,-(sp)
90 >                                        0xa9, 0xfe,                                     // PutScrap()
91 >                                        0x58, 0x8f,                                     // addq.l       #4,sp
92 >                                        M68K_RTS >> 8, M68K_RTS
93 >                                };
94 >                                r.d[0] = sizeof(proc);
95 >                                Execute68kTrap(0xa71e, &r);             // NewPtrSysClear()
96 >                                uint32 proc_area = r.a[0];
97 >
98 >                                if (proc_area) {
99 >                                        Host2Mac_memcpy(proc_area, proc, sizeof(proc));
100 >                                        WriteMacInt32(proc_area +  6, byteCount);
101 >                                        WriteMacInt32(proc_area + 12, type);
102 >                                        WriteMacInt32(proc_area + 18, scrap_area);
103 >                                        we_put_this_data = true;
104 >                                        Execute68k(proc_area, &r);
105 >
106 >                                        r.a[0] = proc_area;
107 >                                        Execute68kTrap(0xa01f, &r);     // DisposePtr
108 >                                }
109 >                        }
110 >
111 >                        r.a[0] = scrap_area;
112 >                        Execute68kTrap(0xa01f, &r);                     // DisposePtr
113 >                }
114          }
115   }
116  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines