summaryrefslogtreecommitdiffstats
path: root/system/fsviewer/close_button.diff
blob: fbbb55e5844fc5fbc5ddf1fbc4045127b211979d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
diff --git a/src/FSFileView.c b/src/FSFileView.c
index 51533d5..175c0ce 100644
--- a/src/FSFileView.c
+++ b/src/FSFileView.c
@@ -41,6 +41,8 @@
 #define DEFAULT_COLUMN_WIDTH 150
 #define COLUMN_PADDING 4 // only used for increment calc here, needs to go
 
+Atom delete_atom;
+
 static void notificationObserver(void* self, WMNotification* notif);
 static void FSAddFileViewShelfItem(FSFileView* fView, FileInfo* fileInfo);
 static void handleShelfButtonActions(WMWidget* self, void* data);
@@ -437,12 +439,14 @@ FSCreateFileView(FSViewer* fsViewer, char* path, Bool primary)
 
     if ((fView->primary)) {
         memset((void*)&attributes, 0, sizeof(MyGNUstepWMAttributes));
-        attributes.window_style = (WMTitledWindowMask | WMMiniaturizableWindowMask | WMResizableWindowMask);
+        attributes.window_style = (WMTitledWindowMask | WMClosableWindowMask | WMMiniaturizableWindowMask | WMResizableWindowMask);
         attributes.window_level = WMNormalWindowLevel;
         attributes.extra_flags = GSFullKeyboardEventsFlag;
         attributes.flags = (GSWindowStyleAttr | GSWindowLevelAttr | GSExtraFlagsAttr);
         MyWMSetWindowAttributes(fView->dpy, WMWidgetXID(fView->fileView),
             &attributes);
+		  delete_atom = XInternAtom(fView->dpy, "WM_DELETE_WINDOW", 0);
+		  XSetWMProtocols(fView->dpy, WMWidgetXID(fView->fileView), &delete_atom, 1);
     }
 
     // WMAppAddWindow(FSGetFSViewerWMContext(fsViewer),
diff --git a/src/FSViewer.c b/src/FSViewer.c
index 9baebfa..d365a83 100644
--- a/src/FSViewer.c
+++ b/src/FSViewer.c
@@ -23,6 +23,8 @@
 
 #define DEBUG 0
 
+extern Atom delete_atom;
+
 /* Application defaults */
 WMUserDefaults* defaultsDB;
 WMPropList* filesDB;
@@ -502,7 +504,8 @@ int main(int argc, char** argv)
             focusIn = False;
             break;
         case ClientMessage:
-            // printf("arrgggg!\n");
+				if(event.xclient.data.l[0] == delete_atom)
+					exit(0);
             break;
         }
     }