» home
» bugs
» git
 

Module Checklist

This is a checklist of common bugs, which have appeared in multiple modules in the past. At some point, after this list has been finalized and there's been some time to fix these issues in major modules, we plan to begin certifying modules against this list, to help users distinguish good modules from buggy ones.

Blocking

If a module blocks (that is, spends a long time on an event handler or a bang command), it causes LiteStep, including parts of the user interface created by other modules, to stop responding. Functions which may block should be avoided, or used from helper threads separate from the main thread.

  • Never use SendMessage to send messages to apps. This may block forever if the target app is crashed.
  • Do not use SendMessageTimeout to send messages to apps from a timer or an event handler which fires without user intervention. In particular, do not use SendMessageTimeout(WM_GETICON, …) from inside a WM_PAINT handler.
  • Do not open files which could be on slow or disconnected network drives

Virtual Desktops

Modules which provide virtual desktops need to move windows off-screen, when their desktop is hidden, and back, when the desktop is shown again. There are many subtle ways to get this wrong.

  • Test on a multimonitor system, with monitors in different arrangements.
  • Test on a multimonitor system where one of the monitors is in negative coordinate space
  • Switching from desk A to desk B should not require disturbing windows on desk C
  • When moving an app from one virtual desktop to another, any tool windows it creates must come with it. To determine which app owns a tool window, first check its parent and owner, and failing that, look for an application window with the same controlling thread.

Child Modules

A module may be loaded as a child of a container module. In that case, the container module provides the parent window to any windows the module creates (by passing the parent window as a parameter to initModuleEx), and may be responsible for its positioning.

  • Use the HWND sent to initModuleEx as the parent of your own window
  • Do not assume that the parent window has its origin at (0,0). Test with a container that is somewhere other than the top-left of the screen
  • Provide bang commands for moving and resizing
  • If the module may resize itself, such as a dynamically resizing tray, provide the option of executing a bang command after resizing

LiteStep Messages

  • Use GetLitestepWnd() when getting the window to send messages to. (Don't use the window you got passed in initModuleEx.)
  • Refresh all settings when an LM_REFRESH message is received
  • Unregister LM_ messages in quitModule

Compatibility

  • Test for Windows Vista and Windows 7 compatibility
  • Handle foreign-language strings for file names, window titles etc. correctly

Module Window

  • If you don't need any special WM_CLOSE handling, set the WNDCLASS attribute 'style' to CS_NOCLOSE. This also removes the need for any special WM_SYSCOMMAND handling.
  • Unregister the window class if CreateWindowEx fails

quitModule

  • Destroy your window, and unregister the window class

LSAPI functions

  • GetRCBool
    • Don't compare the return value with TRUE (use != FALSE instead)
  • GetRCBoolDef
    • Don't compare the return value with TRUE (use != FALSE instead)
 
lsdev/tutorials/module_checklist.txt · Last modified: 2009/03/05 13:11 by tobbe
 
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki