Author: Lars Wassermann <[email protected]>
Branch: 
Changeset: r456:4f4372c774a9
Date: 2013-06-17 13:20 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/4f4372c774a9/

Log:    added correct identification of saved window size and communication
        to the image (via primitive SCREEN_SIZE) needed to add the
        lastWindowSize word to SqueakImage and its maintenance when setting
        the display object (BE_DISPLAY)

diff --git a/spyvm/primitives.py b/spyvm/primitives.py
--- a/spyvm/primitives.py
+++ b/spyvm/primitives.py
@@ -698,8 +698,9 @@
         w_rcvr.store(interp.space, 0, w_display_bitmap)
 
     w_display_bitmap.flush_to_screen()
+    interp.image.lastWindowSize = (width << 16)  + height
+    interp.space.objtable['w_display'] = w_rcvr
 
-    interp.space.objtable['w_display'] = w_rcvr
     return w_rcvr
 
 @expose_primitive(STRING_REPLACE, unwrap_spec=[object, index1_0, index1_0, 
object, index1_0])
@@ -730,11 +731,14 @@
 
 @expose_primitive(SCREEN_SIZE, unwrap_spec=[object])
 def func(interp, s_frame, w_rcvr):
-    # XXX get the real screen size
+    # We need to have the indirection via interp.image, because when the image
+    # is saved, the display form size is always reduced to 240@120.
+    if not interp.image:
+        raise PrimitiveFailedError
     w_res = interp.space.w_Point.as_class_get_shadow(interp.space).new(2)
     point = wrapper.PointWrapper(interp.space, w_res)
-    point.store_x(640)
-    point.store_y(480)
+    point.store_x((interp.image.lastWindowSize >> 16) & 0xffff)
+    point.store_y(interp.image.lastWindowSize & 0xffff)
     return w_res
 
 @expose_primitive(MOUSE_BUTTONS, unwrap_spec=[object])
diff --git a/spyvm/squeakimage.py b/spyvm/squeakimage.py
--- a/spyvm/squeakimage.py
+++ b/spyvm/squeakimage.py
@@ -218,6 +218,8 @@
         # cache wrapper integers
         self.intcache = {}
 
+        self.lastWindowSize = 0
+
     def initialize(self):
         # XXX should be called something like read_full_image
         self.read_header()
@@ -247,8 +249,8 @@
         self.specialobjectspointer = self.stream.next()
         # 1 word last used hash
         lasthash = self.stream.next()
-        savedwindowssize = self.stream.next()
-        # print "savedwindowssize", savedwindowssize
+        self.lastWindowSize = savedwindowssize = self.stream.next()
+        # print "savedwindowssize: ", savedwindowssize >> 16, "@", 
savedwindowssize & 0xffff
         fullscreenflag = self.stream.next()
         extravmmemory = self.stream.next()
         self.stream.skipbytes(headersize - self.stream.pos)
@@ -371,6 +373,7 @@
 
         self.w_asSymbol = self.find_symbol(space, reader, "asSymbol")
         self.w_simulateCopyBits = self.find_symbol(space, reader, 
"simulateCopyBits")
+        self.lastWindowSize = reader.lastWindowSize
 
     def find_symbol(self, space, reader, symbol):
         w_dnu = self.special(constants.SO_DOES_NOT_UNDERSTAND)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to