Continuing development on the implementation of the mouse lock bug, I’ve caught up to my fellow students and Prof. Humphrey in DPS909 by setting up the lock() method.

In my last blog post on the implementation of the MouseLock bug I mentioned I had a working build of firefox with the MouseLockable class code. Yesterday I was able to add the init() and lock() methods to the class, and re-build successfully. I also did a small test in the web console of the nightly build to test the code:

The lock() and unlock() methods are not yet implemented, but I am just changing the value of a variable to test that the code works so far, here it is:

nsresult
nsDOMMouseLockable::Init(nsIDOMWindow* aContentWindow)
{
  NS_ENSURE_ARG_POINTER(aContentWindow);
  // Hang on to the window so we can check for fullscreen
  mWindow = aContentWindow;
  return NS_OK;
}

/* void lock (); */
NS_IMETHODIMP nsDOMMouseLockable::Lock()
{
  mWindow->GetFullScreen(&mIsLocked);  
  mIsLocked = PR_TRUE;
  return NS_OK;
}

/* void unlock (); */
NS_IMETHODIMP nsDOMMouseLockable::Unlock()
{
  mIsLocked = PR_FALSE;
  return NS_OK;
}

/* bool islocked (); */
NS_IMETHODIMP nsDOMMouseLockable::Islocked(bool *_retval NS_OUTPARAM)
{
  NS_ENSURE_ARG_POINTER(_retval);	
  *_retval = mIsLocked;
  return NS_OK;
}

Since my last post, I pulled in code from humphd, diogogmt and rhung into my repository and merged their changes with mine.

Here is my latest commit after the merges and the lock() method code.

Comment now!
















Trackbacks