ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/video_x.cpp
(Generate patch)

Comparing SheepShaver/src/Unix/video_x.cpp (file contents):
Revision 1.13 by gbeauche, 2004-04-10T23:15:21Z vs.
Revision 1.14 by gbeauche, 2004-04-11T10:46:32Z

# Line 340 | Line 340 | static bool find_visual_for_depth(int de
340   *  Open display (window or fullscreen)
341   */
342  
343 + // Set WM_DELETE_WINDOW protocol on window (preventing it from being destroyed by the WM when clicking on the "close" widget)
344 + static Atom WM_DELETE_WINDOW = (Atom)0;
345 + static void set_window_delete_protocol(Window w)
346 + {
347 +        WM_DELETE_WINDOW = XInternAtom(x_display, "WM_DELETE_WINDOW", false);
348 +        XSetWMProtocols(x_display, w, &WM_DELETE_WINDOW, 1);
349 + }
350 +
351   // Wait until window is mapped/unmapped
352   void wait_mapped(Window w)
353   {
# Line 392 | Line 400 | static bool open_window(int width, int h
400          // Set window name
401          XStoreName(x_display, the_win, GetString(STR_WINDOW_TITLE));
402  
403 +        // Set delete protocol property
404 +        set_window_delete_protocol(the_win);
405 +
406          // Make window unresizable
407          XSizeHints *hints;
408          if ((hints = XAllocSizeHints()) != NULL) {
# Line 1423 | Line 1434 | static void handle_events(void)
1434                          else if (XCheckTypedEvent(x_display, SelectionClear, &event))
1435                                  ClipboardSelectionClear(&event.xselectionclear);
1436  
1437 +                        // Window "close" widget clicked
1438 +                        else if (XCheckTypedEvent(x_display, ClientMessage, &event)) {
1439 +                                if (event.xclient.format == 32 && event.xclient.data.l[0] == WM_DELETE_WINDOW) {
1440 +                                        ADBKeyDown(0x7f);       // Power key
1441 +                                        ADBKeyUp(0x7f);
1442 +                                }
1443 +                        }
1444 +
1445                          XDisplayUnlock();
1446                          break;
1447                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines