sugarlabs / letters

Spell words from a group of random letters
GNU General Public License v3.0
1 stars 7 forks source link

Resize causes recursion and process running after stop #3

Closed quozl closed 5 years ago

quozl commented 6 years ago

Resize causes execution recursion, may eventually fail, and leaves a process running after stop.

While in the Pygame main loop Letters.run(), a display resize event is handled by Gtk.main_iteration() which calls PeterActivity.__configure_cb which calls Letters.run() again.

Proven by reporting a traceback in the size-changed handler;

    def __configure_cb(self, event):
        import sys, traceback
        print traceback.print_stack(file=sys.stderr)
        ...

Activity process keeps running because there is only one QUIT event and the going state is local to each instance of run().

rhl-bthr commented 6 years ago

@quozl, In order to test my fix, I needed to call the display-resize event. I can't figure out how to do that. Please guide me how to emit this event.

quozl commented 6 years ago

A size-changed event probably already occurs as the PygameCanvas widget negotiates up from the default 1x1 size to the area provided by the parent Activity.

You can cause the size-changed event by running Sugar inside a virtual machine or rdesktop window and resize the window.

The event may also be caused by using right-click or left-click on the activity toolbar icon.

nswarup14 commented 5 years ago

@quozl Left-click or right-click on the activity toolbar icon does not seem to cause resize as the traceback is not being printed.

Is there any other way to reproduce the error? I currently do not have a VM with me and rdesktop does not seem to be working.

Thanks!

quozl commented 5 years ago

Correct, there is no way for a user to resize the activity using the toolbar, because Sugar activities are always maximised to the display size.

On the OLPC XO laptops there is a rotate button to the left of the display which rotates the image by 90 degrees, effectively changing display resolution from 1200x900 to 900x1200. That's what I use.

Resizing with xrandr should also cause a display-resize event. Try that.

Yet another method is to plug in an external monitor, which may cause a laptop to select a resolution that is compatible with that monitor and the built-in display.

Otherwise you'll have to work on your VM or rdesktop issue.