First, MAKE SURE YOU HAVE SAVED ALL OPEN DOCUMENTS AND QUIT ALL OPEN APPLICATIONS, as quitting WindowServer will immediately force log out, and otherwise you will lose data!!!
Launch Activity Monitor in the Utilities folder.
Type "WindowServer" in the "String Matching" field of Activity Monitor, making sure that "All Processes" or "Other User Processes" is selected in the popup next to it).
Click "WindowServer" (which should now be the only process displayed) to select it.
Click the red "Quit Process" button and choose "Force Quit".
Hope this works for you also!