mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
Add internal notification observer for deselection.
This commit is contained in:
@@ -236,6 +236,13 @@ lostHandler(WMWidget *w, Atom selection)
|
|||||||
paintTextField(tPtr);
|
paintTextField(tPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_notification(void *observerData, WMNotification *notification)
|
||||||
|
{
|
||||||
|
WMTextField *to = (WMTextField*)observerData;
|
||||||
|
WMTextField *tw = (WMTextField*)WMGetNotificationClientData(notification);
|
||||||
|
if (to != tw) lostHandler(to, 0);
|
||||||
|
}
|
||||||
|
|
||||||
WMTextField*
|
WMTextField*
|
||||||
WMCreateTextField(WMWidget *parent)
|
WMCreateTextField(WMWidget *parent)
|
||||||
@@ -285,6 +292,7 @@ WMCreateTextField(WMWidget *parent)
|
|||||||
|
|
||||||
WMCreateSelectionHandler(tPtr, XA_PRIMARY, CurrentTime, requestHandler,
|
WMCreateSelectionHandler(tPtr, XA_PRIMARY, CurrentTime, requestHandler,
|
||||||
lostHandler, NULL);
|
lostHandler, NULL);
|
||||||
|
WMAddNotificationObserver(_notification, tPtr, "_lostOwnership", tPtr);
|
||||||
|
|
||||||
|
|
||||||
tPtr->flags.cursorOn = 1;
|
tPtr->flags.cursorOn = 1;
|
||||||
@@ -1242,6 +1250,13 @@ handleTextFieldActionEvents(XEvent *event, void *data)
|
|||||||
if (move) {
|
if (move) {
|
||||||
XSetSelectionOwner(tPtr->view->screen->display,
|
XSetSelectionOwner(tPtr->view->screen->display,
|
||||||
XA_PRIMARY, tPtr->view->window, CurrentTime);
|
XA_PRIMARY, tPtr->view->window, CurrentTime);
|
||||||
|
{
|
||||||
|
WMNotification *notif = WMCreateNotification("_lostOwnership",
|
||||||
|
NULL,tPtr);
|
||||||
|
puts("notify it");
|
||||||
|
WMPostNotification(notif);
|
||||||
|
WMReleaseNotification(notif);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1339,6 +1354,7 @@ destroyTextField(TextField *tPtr)
|
|||||||
|
|
||||||
WMReleaseFont(tPtr->font);
|
WMReleaseFont(tPtr->font);
|
||||||
WMDeleteSelectionHandler(tPtr, XA_PRIMARY);
|
WMDeleteSelectionHandler(tPtr, XA_PRIMARY);
|
||||||
|
WMRemoveNotificationObserver(tPtr);
|
||||||
|
|
||||||
if (tPtr->text)
|
if (tPtr->text)
|
||||||
free(tPtr->text);
|
free(tPtr->text);
|
||||||
|
|||||||
Reference in New Issue
Block a user