slackbuilds_ponce/system/fsviewer/close_button.diff
B. Watson 4bf110c1c1
system/fsviewer: Updated for version 0.2.6+20220428_38b38a6.
Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2024-01-27 15:37:51 +07:00

52 lines
1.9 KiB
Diff

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;
}
}