comparison src/ExternalClient.c @ 440:8de8e3f6228a r21-2-28

Import from CVS: tag r21-2-28
author cvs
date Mon, 13 Aug 2007 11:33:38 +0200
parents 3ecd8885ac67
children abe6d1db359e
comparison
equal deleted inserted replaced
439:357dd071b03c 440:8de8e3f6228a
75 static int my_error_handler(Display *display, XErrorEvent *xev); 75 static int my_error_handler(Display *display, XErrorEvent *xev);
76 static int (*error_old_handler)(Display *, XErrorEvent *); 76 static int (*error_old_handler)(Display *, XErrorEvent *);
77 77
78 static XtResource resources[] = { 78 static XtResource resources[] = {
79 #define offset(field) XtOffset(ExternalClientWidget, externalClient.field) 79 #define offset(field) XtOffset(ExternalClientWidget, externalClient.field)
80 { XtNshellTimeout, XtCShellTimeout, XtRInt, sizeof(int), 80 { XtNshellTimeout, XtCShellTimeout,
81 offset(shell_timeout), XtRImmediate,(XtPointer)DEFAULT_WM_TIMEOUT}, 81 XtRInt, sizeof (int),
82 { XtNdeadShell, XtCDeadShell, XtRBoolean, sizeof(Boolean), 82 offset(shell_timeout), XtRImmediate,(XtPointer)DEFAULT_WM_TIMEOUT },
83 offset(dead_shell), XtRImmediate, (XtPointer)False}, 83 { XtNdeadShell, XtCDeadShell,
84 #ifdef EXTW_USES_MOTIF 84 XtRBoolean, sizeof (Boolean),
85 { XmNnavigationType, XmCNavigationType, XmRNavigationType, 85 offset(dead_shell), XtRImmediate, (XtPointer)False },
86 sizeof(XmNavigationType), XtOffset(ExternalClientWidget, 86 #ifdef EXTW_USES_MOTIF
87 primitive.navigation_type), XtRImmediate, 87 { XmNnavigationType, XmCNavigationType,
88 (XtPointer)XmTAB_GROUP}, 88 XmRNavigationType, sizeof (XmNavigationType),
89 #endif 89 XtOffset (ExternalClientWidget, primitive.navigation_type),
90 { XtNemacsProcID, XtCEmacsProcID, XtRString, sizeof(String), 90 XtRImmediate, (XtPointer)XmTAB_GROUP },
91 offset(emacs_procid), XtRImmediate, (XtPointer)NULL}, 91 #endif
92 { XtNshellReadyCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList), 92 { XtNemacsProcID, XtCEmacsProcID,
93 offset(shell_ready_callback), XtRImmediate, (XtPointer)NULL}, 93 XtRString, sizeof (String),
94 { XtNshellName, XtCShellName, XtRString, sizeof(String), 94 offset(emacs_procid), XtRImmediate, (XtPointer)NULL },
95 offset(shell_name), XtRImmediate, (XtPointer)NULL}, 95 { XtNshellReadyCallback, XtCCallback,
96 { XtNuseToolTalk, XtCUseToolTalk, XtRBoolean, sizeof(Boolean), 96 XtRCallback, sizeof (XtCallbackList),
97 offset(use_tooltalk), XtRImmediate, (XtPointer)False} 97 offset(shell_ready_callback), XtRImmediate, (XtPointer)NULL },
98 { XtNshellName, XtCShellName,
99 XtRString, sizeof (String),
100 offset(shell_name), XtRImmediate, (XtPointer)NULL },
101 { XtNuseToolTalk, XtCUseToolTalk,
102 XtRBoolean, sizeof (Boolean),
103 offset(use_tooltalk), XtRImmediate, (XtPointer)False }
98 }; 104 };
99 105
100 static XtActionsRec actions[] = { 106 static XtActionsRec actions[] = {
101 {"focusIn", ExternalClientFocusIn}, 107 {"focusIn", ExternalClientFocusIn},
102 {"focusOut", ExternalClientFocusOut}, 108 {"focusOut", ExternalClientFocusOut},
112 /* superclass */ (WidgetClass) &xmPrimitiveClassRec, 118 /* superclass */ (WidgetClass) &xmPrimitiveClassRec,
113 #else 119 #else
114 /* superclass */ (WidgetClass) &coreClassRec, 120 /* superclass */ (WidgetClass) &coreClassRec,
115 #endif 121 #endif
116 /* class_name */ "ExternalClient", 122 /* class_name */ "ExternalClient",
117 /* size */ sizeof(ExternalClientRec), 123 /* size */ sizeof (ExternalClientRec),
118 /* Class Initializer */ NULL, 124 /* Class Initializer */ NULL,
119 /* class_part_initialize*/ NULL, /* XtInheritClassPartInitialize, */ 125 /* class_part_initialize*/ NULL, /* XtInheritClassPartInitialize, */
120 /* Class init'ed ? */ FALSE, 126 /* Class init'ed ? */ FALSE,
121 /* initialize */ externalClientInitialize, 127 /* initialize */ externalClientInitialize,
122 /* initialize_notify */ NULL, 128 /* initialize_notify */ NULL,
123 /* realize */ externalClientRealize, 129 /* realize */ externalClientRealize,
124 /* actions */ actions, 130 /* actions */ actions,
125 /* num_actions */ XtNumber (actions), 131 /* num_actions */ XtNumber (actions),
126 /* resources */ resources, 132 /* resources */ resources,
127 /* resource_count */ XtNumber (resources), 133 /* resource_count */ XtNumber (resources),
128 /* xrm_class */ NULLQUARK, 134 /* xrm_class */ NULLQUARK,
132 /* visible_interest */ TRUE, 138 /* visible_interest */ TRUE,
133 /* destroy */ Destroy, /* XtInheritDestroy, */ 139 /* destroy */ Destroy, /* XtInheritDestroy, */
134 /* resize */ XtInheritResize, 140 /* resize */ XtInheritResize,
135 /* expose */ NULL, 141 /* expose */ NULL,
136 /* set_values */ NULL, /* XtInheritSetValues, */ 142 /* set_values */ NULL, /* XtInheritSetValues, */
137 /* set_values_hook */ NULL, 143 /* set_values_hook */ NULL,
138 /* set_values_almost */ XtInheritSetValuesAlmost, 144 /* set_values_almost */ XtInheritSetValuesAlmost,
139 /* get_values_hook */ NULL, 145 /* get_values_hook */ NULL,
140 /* accept_focus */ NULL, 146 /* accept_focus */ NULL,
141 /* intrinsics version */ XtVersion, 147 /* intrinsics version */ XtVersion,
142 /* callback offsets */ NULL, 148 /* callback offsets */ NULL,
143 /* tm_table */ "", /* MUST NOT BE NULL or 149 /* tm_table */ "", /* MUST NOT BE NULL or
144 XtInheritTranslations in Motif!!!!! 150 XtInheritTranslations in Motif!!!!!
184 provide a proper inheritance mechanism for translations. 190 provide a proper inheritance mechanism for translations.
185 191
186 -- BPW 192 -- BPW
187 193
188 */ 194 */
189 195
190 XtOverrideTranslations (new, 196 XtOverrideTranslations (new,
191 XtParseTranslationTable ("None<Key>Tab:\n" 197 XtParseTranslationTable ("None<Key>Tab:\n"
192 "<FocusIn>:focusIn()\n" 198 "<FocusIn>:focusIn()\n"
193 "<FocusOut>:focusOut()\n" 199 "<FocusOut>:focusOut()\n"
194 "<Enter>:enter()\n" 200 "<Enter>:enter()\n"
195 "<Leave>:leave()\n")); 201 "<Leave>:leave()\n"));
196 202
197 #endif 203 #endif
198 204
199 XtAddEventHandler (new, 0, TRUE, EventHandler, (XtPointer) NULL); 205 XtAddEventHandler (new, 0, TRUE, EventHandler, (XtPointer) NULL);
200 206
201 ecw->externalClient.shell_ready = False; 207 ecw->externalClient.shell_ready = False;
202 ecw->externalClient.has_focus = False; 208 ecw->externalClient.has_focus = False;
203 209
212 #ifdef TOOLTALK 218 #ifdef TOOLTALK
213 static Tt_callback_action 219 static Tt_callback_action
214 tt_callback(Tt_message m, Tt_pattern p) 220 tt_callback(Tt_message m, Tt_pattern p)
215 { 221 {
216 ExternalClientWidget ecw = (ExternalClientWidget)tt_message_user (m, 0); 222 ExternalClientWidget ecw = (ExternalClientWidget)tt_message_user (m, 0);
217 223
218 switch (tt_message_state(m)) 224 switch (tt_message_state(m))
219 { 225 {
220 case TT_FAILED: 226 case TT_FAILED:
221 /* handle errors here */ 227 /* handle errors here */
222 break; 228 break;
224 ecw->externalClient.shell_name = tt_message_arg_val (m, 2); 230 ecw->externalClient.shell_name = tt_message_arg_val (m, 2);
225 XtCallCallbackList ((Widget) ecw, 231 XtCallCallbackList ((Widget) ecw,
226 ecw->externalClient.shell_ready_callback, NULL); 232 ecw->externalClient.shell_ready_callback, NULL);
227 break; 233 break;
228 } 234 }
229 235
230 tt_message_destroy (m); 236 tt_message_destroy (m);
231 return TT_CALLBACK_PROCESSED; 237 return TT_CALLBACK_PROCESSED;
232 } 238 }
233 239
234 static void 240 static void
239 tt_message_op_set (m, "emacs-make-client-screen"); 245 tt_message_op_set (m, "emacs-make-client-screen");
240 tt_message_scope_set (m, TT_SESSION); 246 tt_message_scope_set (m, TT_SESSION);
241 tt_message_class_set (m, TT_REQUEST); 247 tt_message_class_set (m, TT_REQUEST);
242 tt_message_arg_add (m, TT_IN, "string", name); 248 tt_message_arg_add (m, TT_IN, "string", name);
243 tt_message_iarg_add (m, TT_IN, "int", win); 249 tt_message_iarg_add (m, TT_IN, "int", win);
244 tt_message_arg_add (m, TT_OUT, "string", NULL); 250 tt_message_arg_add (m, TT_OUT, "string", NULL);
245 tt_message_user_set (m, 0, (void *)ecw); 251 tt_message_user_set (m, 0, (void *)ecw);
246 tt_message_callback_add (m, tt_callback); 252 tt_message_callback_add (m, tt_callback);
247 if (ecw->externalClient.emacs_procid) 253 if (ecw->externalClient.emacs_procid)
248 { 254 {
249 tt_message_address_set (m, TT_HANDLER); 255 tt_message_address_set (m, TT_HANDLER);
259 265
260 static void 266 static void
261 externalClientRealize (Widget w, XtValueMask *vm, XSetWindowAttributes *attrs) 267 externalClientRealize (Widget w, XtValueMask *vm, XSetWindowAttributes *attrs)
262 { 268 {
263 ExternalClientWidget ecw = (ExternalClientWidget)w; 269 ExternalClientWidget ecw = (ExternalClientWidget)w;
264 270
265 #ifdef EXTW_USES_MOTIF 271 #ifdef EXTW_USES_MOTIF
266 (*xmPrimitiveWidgetClass->core_class.realize) (w, vm, attrs); 272 (*xmPrimitiveWidgetClass->core_class.realize) (w, vm, attrs);
267 #else 273 #else
268 (*coreWidgetClass->core_class.realize) (w, vm, attrs); 274 (*coreWidgetClass->core_class.realize) (w, vm, attrs);
269 #endif 275 #endif
270 276
276 if (ecw->externalClient.use_tooltalk) 282 if (ecw->externalClient.use_tooltalk)
277 { 283 {
278 XSync (XtDisplay (w), False); 284 XSync (XtDisplay (w), False);
279 send_tooltalk_handshake (ecw, XtWindow (w), XtName (w)); 285 send_tooltalk_handshake (ecw, XtWindow (w), XtName (w));
280 } 286 }
281 #endif 287 #endif
282 } 288 }
283 289
284 290
285 /***********************************************************************/ 291 /***********************************************************************/
286 292
312 static Widget 318 static Widget
313 remove_ww (Window win) 319 remove_ww (Window win)
314 { 320 {
315 struct ww_list *w1, *w2; 321 struct ww_list *w1, *w2;
316 Widget wid = 0; 322 Widget wid = 0;
317 323
318 for (w1=ww_list, w2=w1->next; w2; w1=w2, w2=w2->next) 324 for (w1=ww_list, w2=w1->next; w2; w1=w2, w2=w2->next)
319 if (w2->win == win) 325 if (w2->win == win)
320 { 326 {
321 w1->next = w2->next; 327 w1->next = w2->next;
322 wid = w2->wid; 328 wid = w2->wid;
364 end_connection (ExternalClientWidget w) 370 end_connection (ExternalClientWidget w)
365 { 371 {
366 XSetWindowAttributes xswa; 372 XSetWindowAttributes xswa;
367 XtValueMask mask; 373 XtValueMask mask;
368 Widget wid = (Widget) w; 374 Widget wid = (Widget) w;
369 375
370 w->externalClient.shell_ready = False; 376 w->externalClient.shell_ready = False;
371 XtRemoveEventHandler (wid, w->externalClient.event_mask, 377 XtRemoveEventHandler (wid, w->externalClient.event_mask,
372 FALSE, MaskableEventHandler, (XtPointer) NULL); 378 FALSE, MaskableEventHandler, (XtPointer) NULL);
373 ComputeWindowAttributes (wid, &mask, &xswa); 379 ComputeWindowAttributes (wid, &mask, &xswa);
374 XChangeWindowAttributes (XtDisplay (wid), XtWindow (wid), mask, &xswa); 380 XChangeWindowAttributes (XtDisplay (wid), XtWindow (wid), mask, &xswa);
377 383
378 static int 384 static int
379 my_error_handler (Display *display, XErrorEvent *xev) 385 my_error_handler (Display *display, XErrorEvent *xev)
380 { 386 {
381 Widget wid; 387 Widget wid;
382 388
383 if (xev->error_code != BadWindow) 389 if (xev->error_code != BadWindow)
384 goto call_old; 390 goto call_old;
385 wid = remove_ww (xev->resourceid); 391 wid = remove_ww (xev->resourceid);
386 if (wid) 392 if (wid)
387 { 393 {
388 end_connection ((ExternalClientWidget) wid); 394 end_connection ((ExternalClientWidget) wid);
389 return 0; 395 return 0;
390 } 396 }
391 397
392 call_old: 398 call_old:
393 return error_old_handler (display, xev); 399 return error_old_handler (display, xev);
394 } 400 }
395 401
396 static void 402 static void
397 MaskableEventHandler (Widget wid, XtPointer closure, XEvent *event, 403 MaskableEventHandler (Widget wid, XtPointer closure, XEvent *event,
398 Boolean *continue_to_dispatch) 404 Boolean *continue_to_dispatch)
399 /* closure and continue_to_dispatch unused */ 405 /* closure and continue_to_dispatch unused */
400 { 406 {
401 ExternalClientWidget w = (ExternalClientWidget) wid; 407 ExternalClientWidget w = (ExternalClientWidget) wid;
402 408
403 if (w->externalClient.shell_ready) 409 if (w->externalClient.shell_ready)
404 { 410 {
405 if (event->type == KeyPress || event->type == KeyRelease || 411 if (event->type == KeyPress || event->type == KeyRelease ||
406 event->type == ButtonPress || event->type == ButtonRelease || 412 event->type == ButtonPress || event->type == ButtonRelease ||
407 event->type == MotionNotify) 413 event->type == MotionNotify)
419 XSendEvent (XtDisplay (wid), w->externalClient.event_window, FALSE, 0, 425 XSendEvent (XtDisplay (wid), w->externalClient.event_window, FALSE, 0,
420 event); 426 event);
421 XSync (XtDisplay (wid), 0); /* make sure that any BadWindow errors 427 XSync (XtDisplay (wid), 0); /* make sure that any BadWindow errors
422 (meaning the server died) get handled 428 (meaning the server died) get handled
423 before XSendEvent is called again. */ 429 before XSendEvent is called again. */
424 430
425 } 431 }
426 } 432 }
427 433
428 static void 434 static void
429 EventHandler (Widget wid, XtPointer closure, XEvent *event, 435 EventHandler (Widget wid, XtPointer closure, XEvent *event,
430 Boolean *continue_to_dispatch) 436 Boolean *continue_to_dispatch)
431 /* closure and continue_to_dispatch unused */ 437 /* closure and continue_to_dispatch unused */
432 { 438 {
433 ExternalClientWidget w = (ExternalClientWidget) wid; 439 ExternalClientWidget w = (ExternalClientWidget) wid;
434 440
435 if (w->core.window != event->xany.window) 441 if (w->core.window != event->xany.window)
436 { 442 {
437 XtAppErrorMsg (XtWidgetToApplicationContext (wid), 443 XtAppErrorMsg (XtWidgetToApplicationContext (wid),
438 "invalidWindow","eventHandler",XtCXtToolkitError, 444 "invalidWindow","eventHandler",XtCXtToolkitError,
439 "Event with wrong window", 445 "Event with wrong window",
440 (String *)NULL, (Cardinal *)NULL); 446 (String *)NULL, (Cardinal *)NULL);
441 return; 447 return;
442 } 448 }
443 449
444 if (event->type == ClientMessage && 450 if (event->type == ClientMessage &&
445 event->xclient.message_type == a_EXTW_NOTIFY && 451 event->xclient.message_type == a_EXTW_NOTIFY &&
446 event->xclient.data.l[0] == extw_shell_send) 452 event->xclient.data.l[0] == extw_shell_send)
447 switch (event->xclient.data.l[1]) 453 switch (event->xclient.data.l[1])
448 { 454 {
449 455
450 case extw_notify_qg: 456 case extw_notify_qg:
451 /* shell is alive again. */ 457 /* shell is alive again. */
452 458
453 w->externalClient.dead_shell = False; 459 w->externalClient.dead_shell = False;
454 break; 460 break;
455 461
456 case extw_notify_gm: 462 case extw_notify_gm:
457 { 463 {
458 XtWidgetGeometry xwg, xwg_return; 464 XtWidgetGeometry xwg, xwg_return;
459 XtGeometryResult result; 465 XtGeometryResult result;
460 466
461 extw_get_geometry_value (XtDisplay (wid), XtWindow (wid), 467 extw_get_geometry_value (XtDisplay (wid), XtWindow (wid),
462 a_EXTW_GEOMETRY_MANAGER, &xwg); 468 a_EXTW_GEOMETRY_MANAGER, &xwg);
463 result = XtMakeGeometryRequest (wid, &xwg, &xwg_return); 469 result = XtMakeGeometryRequest (wid, &xwg, &xwg_return);
464 470
465 extw_send_geometry_value (XtDisplay (wid), XtWindow (wid), 471 extw_send_geometry_value (XtDisplay (wid), XtWindow (wid),
466 a_EXTW_GEOMETRY_MANAGER, extw_notify_gm, 472 a_EXTW_GEOMETRY_MANAGER, extw_notify_gm,
467 result == XtGeometryAlmost ? &xwg_return : 473 result == XtGeometryAlmost ? &xwg_return :
468 NULL, result); 474 NULL, result);
469 break; 475 break;
470 } 476 }
471 477
472 case extw_notify_init: 478 case extw_notify_init:
473 w->externalClient.shell_ready = True; 479 w->externalClient.shell_ready = True;
474 w->externalClient.event_window = event->xclient.data.l[2]; 480 w->externalClient.event_window = event->xclient.data.l[2];
475 w->externalClient.event_mask = event->xclient.data.l[3]; 481 w->externalClient.event_mask = event->xclient.data.l[3];
476 add_ww (w->externalClient.event_window, (Widget) w); 482 add_ww (w->externalClient.event_window, (Widget) w);
477 483
478 XtAddEventHandler (wid, w->externalClient.event_mask, 484 XtAddEventHandler (wid, w->externalClient.event_mask,
479 FALSE, MaskableEventHandler, (XtPointer) NULL); 485 FALSE, MaskableEventHandler, (XtPointer) NULL);
480 #ifdef EXTW_USES_MOTIF 486 #ifdef EXTW_USES_MOTIF
481 NOTIFY (w, extw_notify_init, 487 NOTIFY (w, extw_notify_init,
482 EXTW_TYPE_MOTIF, 488 EXTW_TYPE_MOTIF,
485 NOTIFY (w, extw_notify_init, 491 NOTIFY (w, extw_notify_init,
486 EXTW_TYPE_XT, 492 EXTW_TYPE_XT,
487 0, 0); 493 0, 0);
488 #endif 494 #endif
489 break; 495 break;
490 496
491 case extw_notify_end: 497 case extw_notify_end:
492 end_connection (w); 498 end_connection (w);
493 remove_ww (w->externalClient.event_window); 499 remove_ww (w->externalClient.event_window);
494 break; 500 break;
495 501
496 case extw_notify_set_focus: 502 case extw_notify_set_focus:
497 #ifdef EXTW_USES_MOTIF 503 #ifdef EXTW_USES_MOTIF
498 XmProcessTraversal (wid, XmTRAVERSE_CURRENT); 504 XmProcessTraversal (wid, XmTRAVERSE_CURRENT);
499 #else 505 #else
500 XtSetKeyboardFocus (wid, None); 506 XtSetKeyboardFocus (wid, None);
501 #endif 507 #endif
502 break; 508 break;
503 509
504 } 510 }
505 } 511 }
506 512
507 static void Destroy(wid) 513 static void Destroy(wid)
508 Widget wid; 514 Widget wid;
509 { 515 {
510 ExternalClientWidget w = (ExternalClientWidget)wid; 516 ExternalClientWidget w = (ExternalClientWidget)wid;
511 517
512 NOTIFY(w, extw_notify_end, 0, 0, 0); 518 NOTIFY(w, extw_notify_end, 0, 0, 0);
513 } 519 }
514 520
515 static XtGeometryResult QueryGeometry(gw, request, reply) 521 static XtGeometryResult QueryGeometry(gw, request, reply)
516 Widget gw; 522 Widget gw;
519 ExternalClientWidget w = (ExternalClientWidget)gw; 525 ExternalClientWidget w = (ExternalClientWidget)gw;
520 XEvent event; 526 XEvent event;
521 unsigned long request_num; 527 unsigned long request_num;
522 Display *display = XtDisplay(gw); 528 Display *display = XtDisplay(gw);
523 XtWidgetGeometry req = *request; /* don't modify caller's structure */ 529 XtWidgetGeometry req = *request; /* don't modify caller's structure */
524 530
525 if (!XtIsRealized((Widget)w) || !w->externalClient.shell_ready) 531 if (!XtIsRealized((Widget)w) || !w->externalClient.shell_ready)
526 return XtGeometryYes; 532 return XtGeometryYes;
527 533
528 if (w->externalClient.dead_shell == TRUE) 534 if (w->externalClient.dead_shell == TRUE)
529 /* The shell is sick. */ 535 /* The shell is sick. */
530 return XtGeometryNo; 536 return XtGeometryNo;
531 537
532 req.sibling = None; 538 req.sibling = None;
533 req.request_mode &= ~CWSibling; 539 req.request_mode &= ~CWSibling;
534 request_num = NextRequest(display); 540 request_num = NextRequest(display);
535 extw_send_geometry_value(XtDisplay(gw), XtWindow(gw), a_EXTW_QUERY_GEOMETRY, 541 extw_send_geometry_value(XtDisplay(gw), XtWindow(gw), a_EXTW_QUERY_GEOMETRY,
536 extw_notify_qg, &req, 0); 542 extw_notify_qg, &req, 0);
552 558
553 static void ExternalClientFocusIn (Widget w, XEvent *event, String *params, 559 static void ExternalClientFocusIn (Widget w, XEvent *event, String *params,
554 Cardinal *num_params) 560 Cardinal *num_params)
555 { 561 {
556 ExternalClientWidget ecw = (ExternalClientWidget) w; 562 ExternalClientWidget ecw = (ExternalClientWidget) w;
557 563
558 if (event->xfocus.send_event && !ecw->externalClient.has_focus) { 564 if (event->xfocus.send_event && !ecw->externalClient.has_focus) {
559 ecw->externalClient.has_focus = True; 565 ecw->externalClient.has_focus = True;
560 NOTIFY(ecw, extw_notify_focus_in, 0, 0, 0); 566 NOTIFY(ecw, extw_notify_focus_in, 0, 0, 0);
561 } 567 }
562 #ifdef EXTW_USES_MOTIF 568 #ifdef EXTW_USES_MOTIF
566 572
567 static void ExternalClientFocusOut (Widget w, XEvent *event, String *params, 573 static void ExternalClientFocusOut (Widget w, XEvent *event, String *params,
568 Cardinal *num_params) 574 Cardinal *num_params)
569 { 575 {
570 ExternalClientWidget ecw = (ExternalClientWidget) w; 576 ExternalClientWidget ecw = (ExternalClientWidget) w;
571 577
572 if (event->xfocus.send_event && ecw->externalClient.has_focus) { 578 if (event->xfocus.send_event && ecw->externalClient.has_focus) {
573 ecw->externalClient.has_focus = False; 579 ecw->externalClient.has_focus = False;
574 NOTIFY(ecw, extw_notify_focus_out, 0, 0, 0); 580 NOTIFY(ecw, extw_notify_focus_out, 0, 0, 0);
575 } 581 }
576 #ifdef EXTW_USES_MOTIF 582 #ifdef EXTW_USES_MOTIF
580 586
581 static void ExternalClientEnter (Widget w, XEvent *event, String *params, 587 static void ExternalClientEnter (Widget w, XEvent *event, String *params,
582 Cardinal *num_params) 588 Cardinal *num_params)
583 { 589 {
584 ExternalClientWidget ecw = (ExternalClientWidget) w; 590 ExternalClientWidget ecw = (ExternalClientWidget) w;
585 591
586 if ( 592 if (
587 #ifdef EXTW_USES_MOTIF 593 #ifdef EXTW_USES_MOTIF
588 _XmGetFocusPolicy (w) != XmEXPLICIT && 594 _XmGetFocusPolicy (w) != XmEXPLICIT &&
589 #endif 595 #endif
590 !ecw->externalClient.has_focus && 596 !ecw->externalClient.has_focus &&
599 605
600 static void ExternalClientLeave (Widget w, XEvent *event, String *params, 606 static void ExternalClientLeave (Widget w, XEvent *event, String *params,
601 Cardinal *num_params) 607 Cardinal *num_params)
602 { 608 {
603 ExternalClientWidget ecw = (ExternalClientWidget) w; 609 ExternalClientWidget ecw = (ExternalClientWidget) w;
604 610
605 if ( 611 if (
606 #ifdef EXTW_USES_MOTIF 612 #ifdef EXTW_USES_MOTIF
607 _XmGetFocusPolicy (w) != XmEXPLICIT && 613 _XmGetFocusPolicy (w) != XmEXPLICIT &&
608 #endif 614 #endif
609 ecw->externalClient.has_focus && 615 ecw->externalClient.has_focus &&