Mercurial > vim
comparison src/gui_xmebw.c @ 18788:e1f4e9d78a6a v8.1.2383
patch 8.1.2383: using old C style comments
Commit: https://github.com/vim/vim/commit/734a867ffe198886da7365b618be67ab8ed9d9f6
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Dec 2 22:49:38 2019 +0100
patch 8.1.2383: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 02 Dec 2019 23:00:04 +0100 |
parents | 2ad5f0ffaa2e |
children | 49d866e9b439 |
comparison
equal
deleted
inserted
replaced
18787:06ed2fe62dce | 18788:e1f4e9d78a6a |
---|---|
50 #include <X11/Shell.h> | 50 #include <X11/Shell.h> |
51 #include <X11/ShellP.h> | 51 #include <X11/ShellP.h> |
52 | 52 |
53 #include "gui_xmebwp.h" | 53 #include "gui_xmebwp.h" |
54 | 54 |
55 /* Provide some missing wrappers, which are missed from the LessTif | 55 // Provide some missing wrappers, which are missed from the LessTif |
56 * implementation. Also missing in Motif 1.2 and earlier. | 56 // implementation. Also missing in Motif 1.2 and earlier. |
57 * | 57 // |
58 * We neither use XmeGetPixmapData or _XmGetPixmapData, since with LessTif the | 58 // We neither use XmeGetPixmapData or _XmGetPixmapData, since with LessTif the |
59 * pixmap will not appear in its caches properly. We cache the interesting | 59 // pixmap will not appear in its caches properly. We cache the interesting |
60 * values in XmEnhancedButtonPart instead ourself. | 60 // values in XmEnhancedButtonPart instead ourself. |
61 */ | |
62 #if defined(LESSTIF_VERSION) || (XmVersion <= 1002) | 61 #if defined(LESSTIF_VERSION) || (XmVersion <= 1002) |
63 # ifndef Lab_IsMenupane | 62 # ifndef Lab_IsMenupane |
64 # define Lab_IsMenupane(w) (Lab_MenuType(w) == (int)XmMENU_POPUP || \ | 63 # define Lab_IsMenupane(w) (Lab_MenuType(w) == (int)XmMENU_POPUP || \ |
65 Lab_MenuType(w) == (int)XmMENU_PULLDOWN) | 64 Lab_MenuType(w) == (int)XmMENU_PULLDOWN) |
66 # endif | 65 # endif |
72 | 71 |
73 /* | 72 /* |
74 * Motif internals we have to cheat around with. | 73 * Motif internals we have to cheat around with. |
75 */ | 74 */ |
76 | 75 |
77 /* Hopefully this will never change... */ | 76 // Hopefully this will never change... |
78 #ifndef XmFOCUS_IGNORE | 77 #ifndef XmFOCUS_IGNORE |
79 # define XmFOCUS_IGNORE 1<<1 | 78 # define XmFOCUS_IGNORE 1<<1 |
80 #endif | 79 #endif |
81 | 80 |
82 extern Boolean _XmGetInDragMode(Widget widget); | 81 extern Boolean _XmGetInDragMode(Widget widget); |
142 XtOffsetOf(XmEnhancedButtonRec, enhancedbutton.label_location), | 141 XtOffsetOf(XmEnhancedButtonRec, enhancedbutton.label_location), |
143 XtRImmediate, (XtPointer) XmRIGHT | 142 XtRImmediate, (XtPointer) XmRIGHT |
144 } | 143 } |
145 }; | 144 }; |
146 | 145 |
147 /* This is needed to work around a bug in Lesstif 2, leaving the extension | 146 // This is needed to work around a bug in Lesstif 2, leaving the extension |
148 * NULL somehow results in getting it set to an invalid pointer. */ | 147 // NULL somehow results in getting it set to an invalid pointer. |
149 XmPrimitiveClassExtRec xmEnhancedButtonPrimClassExtRec = | 148 XmPrimitiveClassExtRec xmEnhancedButtonPrimClassExtRec = |
150 { | 149 { |
151 /* next_extension */ NULL, | 150 /* next_extension */ NULL, |
152 /* record_type */ NULLQUARK, | 151 /* record_type */ NULLQUARK, |
153 /* version */ XmPrimitiveClassExtVersion, | 152 /* version */ XmPrimitiveClassExtVersion, |
158 }; | 157 }; |
159 | 158 |
160 XmEnhancedButtonClassRec xmEnhancedButtonClassRec = | 159 XmEnhancedButtonClassRec xmEnhancedButtonClassRec = |
161 { | 160 { |
162 { | 161 { |
163 /* core_class fields */ | 162 // core_class fields |
164 /* superclass */ (WidgetClass) & xmPushButtonClassRec, | 163 /* superclass */ (WidgetClass) & xmPushButtonClassRec, |
165 /* class_name */ "XmEnhancedButton", | 164 /* class_name */ "XmEnhancedButton", |
166 /* widget_size */ sizeof(XmEnhancedButtonRec), | 165 /* widget_size */ sizeof(XmEnhancedButtonRec), |
167 /* class_initialize */ NULL, | 166 /* class_initialize */ NULL, |
168 /* class_part_initialize */ NULL, | 167 /* class_part_initialize */ NULL, |
193 /* query_geometry */ NULL, | 192 /* query_geometry */ NULL, |
194 /* display_accelerator */ XtInheritDisplayAccelerator, | 193 /* display_accelerator */ XtInheritDisplayAccelerator, |
195 /* extension */ NULL | 194 /* extension */ NULL |
196 }, | 195 }, |
197 | 196 |
198 /* primitive_class fields */ | 197 // primitive_class fields |
199 { | 198 { |
200 /* border highlight */ BorderHighlight, | 199 /* border highlight */ BorderHighlight, |
201 /* border_unhighlight */ BorderUnhighlight, | 200 /* border_unhighlight */ BorderUnhighlight, |
202 /* translations */ XtInheritTranslations, | 201 /* translations */ XtInheritTranslations, |
203 /* arm and activate */ XmInheritArmAndActivate, | 202 /* arm and activate */ XmInheritArmAndActivate, |
204 /* synthetic resources */ NULL, | 203 /* synthetic resources */ NULL, |
205 /* number of syn res */ 0, | 204 /* number of syn res */ 0, |
206 /* extension */ (XtPointer)&xmEnhancedButtonPrimClassExtRec, | 205 /* extension */ (XtPointer)&xmEnhancedButtonPrimClassExtRec, |
207 }, | 206 }, |
208 | 207 |
209 /* label_class fields */ | 208 // label_class fields |
210 { | 209 { |
211 /* setOverrideCallback */ XmInheritSetOverrideCallback, | 210 /* setOverrideCallback */ XmInheritSetOverrideCallback, |
212 /* menuProcs */ XmInheritMenuProc, | 211 /* menuProcs */ XmInheritMenuProc, |
213 /* translations */ XtInheritTranslations, | 212 /* translations */ XtInheritTranslations, |
214 /* extension */ NULL, | 213 /* extension */ NULL, |
215 }, | 214 }, |
216 | 215 |
217 /* pushbutton_class record */ | 216 // pushbutton_class record |
218 { | 217 { |
219 /* extension */ (XtPointer) NULL, | 218 /* extension */ (XtPointer) NULL, |
220 }, | 219 }, |
221 | 220 |
222 /* enhancedbutton_class fields */ | 221 // enhancedbutton_class fields |
223 { | 222 { |
224 /* stipple_bitmap */ None | 223 /* stipple_bitmap */ None |
225 } | 224 } |
226 }; | 225 }; |
227 | 226 |
260 | 259 |
261 status = XAllocColor(display, colormap, xcolor); | 260 status = XAllocColor(display, colormap, xcolor); |
262 return status != 0 ? 1 : 0; | 261 return status != 0 ? 1 : 0; |
263 } | 262 } |
264 | 263 |
265 /* XPM */ | 264 // XPM |
266 static char * blank_xpm[] = | 265 static char * blank_xpm[] = |
267 { | 266 { |
268 /* width height ncolors cpp [x_hot y_hot] */ | 267 // width height ncolors cpp [x_hot y_hot] |
269 "12 12 4 1 0 0", | 268 "12 12 4 1 0 0", |
270 /* colors */ | 269 // colors |
271 " s iconColor1 m black c #000000", | 270 " s iconColor1 m black c #000000", |
272 ". s none m none c none", | 271 ". s none m none c none", |
273 "X s topShadowColor m none c #DCDEE5", | 272 "X s topShadowColor m none c #DCDEE5", |
274 "o s bottomShadowColor m black c #5D6069", | 273 "o s bottomShadowColor m black c #5D6069", |
275 /* pixels */ | 274 // pixels |
276 " ..", | 275 " ..", |
277 " XXXXXXXX ..", | 276 " XXXXXXXX ..", |
278 " X....... o.", | 277 " X....... o.", |
279 " X....... o.", | 278 " X....... o.", |
280 " X....... o.", | 279 " X....... o.", |
290 * Set the pixmap. | 289 * Set the pixmap. |
291 */ | 290 */ |
292 static void | 291 static void |
293 set_pixmap(XmEnhancedButtonWidget eb) | 292 set_pixmap(XmEnhancedButtonWidget eb) |
294 { | 293 { |
295 /* Configure defines XPMATTRIBUTES_TYPE as XpmAttributes or as | 294 // Configure defines XPMATTRIBUTES_TYPE as XpmAttributes or as |
296 * XpmAttributes_21, depending on what is in Xm/XpmP.h. */ | 295 // XpmAttributes_21, depending on what is in Xm/XpmP.h. |
297 XPMATTRIBUTES_TYPE attr; | 296 XPMATTRIBUTES_TYPE attr; |
298 Pixmap sen_pix; | 297 Pixmap sen_pix; |
299 Window root; | 298 Window root; |
300 static XpmColorSymbol color[8] = { | 299 static XpmColorSymbol color[8] = { |
301 {"none", "none", 0}, | 300 {"none", "none", 0}, |
321 char **data = (char **) eb->enhancedbutton.pixmap_data; | 320 char **data = (char **) eb->enhancedbutton.pixmap_data; |
322 char *fname = (char *) eb->enhancedbutton.pixmap_file; | 321 char *fname = (char *) eb->enhancedbutton.pixmap_file; |
323 int shift; | 322 int shift; |
324 GC gc; | 323 GC gc; |
325 | 324 |
326 /* Make sure there is a default value for the pixmap. | 325 // Make sure there is a default value for the pixmap. |
327 */ | |
328 if (!data) | 326 if (!data) |
329 return; | 327 return; |
330 | 328 |
331 gc = XtGetGC((Widget)eb, (XtGCMask)0, NULL); | 329 gc = XtGetGC((Widget)eb, (XtGCMask)0, NULL); |
332 | 330 |
341 eb->enhancedbutton.normal_pixmap = None; | 339 eb->enhancedbutton.normal_pixmap = None; |
342 eb->enhancedbutton.armed_pixmap = None; | 340 eb->enhancedbutton.armed_pixmap = None; |
343 eb->enhancedbutton.highlight_pixmap = None; | 341 eb->enhancedbutton.highlight_pixmap = None; |
344 eb->enhancedbutton.insensitive_pixmap = None; | 342 eb->enhancedbutton.insensitive_pixmap = None; |
345 | 343 |
346 /* We use dynamic colors, get them now. */ | 344 // We use dynamic colors, get them now. |
347 motif_get_toolbar_colors( | 345 motif_get_toolbar_colors( |
348 &eb->core.background_pixel, | 346 &eb->core.background_pixel, |
349 &eb->primitive.foreground, | 347 &eb->primitive.foreground, |
350 &eb->primitive.bottom_shadow_color, | 348 &eb->primitive.bottom_shadow_color, |
351 &eb->primitive.top_shadow_color, | 349 &eb->primitive.top_shadow_color, |
352 &eb->primitive.highlight_color); | 350 &eb->primitive.highlight_color); |
353 | 351 |
354 /* Setup color substitution table. */ | 352 // Setup color substitution table. |
355 color[0].pixel = eb->core.background_pixel; | 353 color[0].pixel = eb->core.background_pixel; |
356 color[1].pixel = eb->core.background_pixel; | 354 color[1].pixel = eb->core.background_pixel; |
357 color[2].pixel = eb->core.background_pixel; | 355 color[2].pixel = eb->core.background_pixel; |
358 color[3].pixel = eb->primitive.foreground; | 356 color[3].pixel = eb->primitive.foreground; |
359 color[4].pixel = eb->core.background_pixel; | 357 color[4].pixel = eb->core.background_pixel; |
360 color[5].pixel = eb->primitive.top_shadow_color; | 358 color[5].pixel = eb->primitive.top_shadow_color; |
361 color[6].pixel = eb->primitive.highlight_color; | 359 color[6].pixel = eb->primitive.highlight_color; |
362 color[7].pixel = eb->pushbutton.arm_color; | 360 color[7].pixel = eb->pushbutton.arm_color; |
363 | 361 |
364 /* Create the "sensitive" pixmap. */ | 362 // Create the "sensitive" pixmap. |
365 attr.valuemask = XpmColorSymbols | XpmCloseness; | 363 attr.valuemask = XpmColorSymbols | XpmCloseness; |
366 attr.closeness = 65535; /* accuracy isn't crucial */ | 364 attr.closeness = 65535; // accuracy isn't crucial |
367 attr.colorsymbols = color; | 365 attr.colorsymbols = color; |
368 attr.numsymbols = XtNumber(color); | 366 attr.numsymbols = XtNumber(color); |
369 | 367 |
370 if (fname) | 368 if (fname) |
371 status = XpmReadFileToPixmap(dpy, root, fname, &pix, &mask, &attr); | 369 status = XpmReadFileToPixmap(dpy, root, fname, &pix, &mask, &attr); |
372 if (!fname || status != XpmSuccess) | 370 if (!fname || status != XpmSuccess) |
373 status = XpmCreatePixmapFromData(dpy, root, data, &pix, &mask, &attr); | 371 status = XpmCreatePixmapFromData(dpy, root, data, &pix, &mask, &attr); |
374 | 372 |
375 /* If something failed, we will fill in the default pixmap. */ | 373 // If something failed, we will fill in the default pixmap. |
376 if (status != XpmSuccess) | 374 if (status != XpmSuccess) |
377 status = XpmCreatePixmapFromData(dpy, root, blank_xpm, &pix, | 375 status = XpmCreatePixmapFromData(dpy, root, blank_xpm, &pix, |
378 &mask, &attr); | 376 &mask, &attr); |
379 | 377 |
380 XpmFreeAttributes(&attr); | 378 XpmFreeAttributes(&attr); |
381 | 379 |
382 XGetGeometry(dpy, pix, &root, &x, &y, &width, &height, &border, &depth); | 380 XGetGeometry(dpy, pix, &root, &x, &y, &width, &height, &border, &depth); |
383 | 381 |
384 /* TODO: does the shift depend on label_location somehow? */ | 382 // TODO: does the shift depend on label_location somehow? |
385 shift = eb->primitive.shadow_thickness / 2; | 383 shift = eb->primitive.shadow_thickness / 2; |
386 | 384 |
387 if (shift < 1) | 385 if (shift < 1) |
388 shift = 1; | 386 shift = 1; |
389 | 387 |
393 XFillRectangle(dpy, sen_pix, gc, 0, 0, width + shift, height + shift); | 391 XFillRectangle(dpy, sen_pix, gc, 0, 0, width + shift, height + shift); |
394 XSetClipMask(dpy, gc, mask); | 392 XSetClipMask(dpy, gc, mask); |
395 XSetClipOrigin(dpy, gc, shift, shift); | 393 XSetClipOrigin(dpy, gc, shift, shift); |
396 XCopyArea(dpy, pix, sen_pix, gc, 0, 0, width, height, shift, shift); | 394 XCopyArea(dpy, pix, sen_pix, gc, 0, 0, width, height, shift, shift); |
397 | 395 |
398 /* Create the "highlight" pixmap. */ | 396 // Create the "highlight" pixmap. |
399 color[4].pixel = eb->primitive.bottom_shadow_color; | 397 color[4].pixel = eb->primitive.bottom_shadow_color; |
400 #ifdef XpmAllocColor /* SGI doesn't have it */ | 398 #ifdef XpmAllocColor // SGI doesn't have it |
401 attr.valuemask = XpmColorSymbols | XpmCloseness | XpmAllocColor; | 399 attr.valuemask = XpmColorSymbols | XpmCloseness | XpmAllocColor; |
402 attr.alloc_color = alloc_color; | 400 attr.alloc_color = alloc_color; |
403 #else | 401 #else |
404 attr.valuemask = XpmColorSymbols | XpmCloseness; | 402 attr.valuemask = XpmColorSymbols | XpmCloseness; |
405 #endif | 403 #endif |
406 attr.closeness = 65535; /* accuracy isn't crucial */ | 404 attr.closeness = 65535; // accuracy isn't crucial |
407 attr.colorsymbols = color; | 405 attr.colorsymbols = color; |
408 attr.numsymbols = XtNumber(color); | 406 attr.numsymbols = XtNumber(color); |
409 | 407 |
410 status = XpmCreatePixmapFromData(dpy, root, data, &pix, NULL, &attr); | 408 status = XpmCreatePixmapFromData(dpy, root, data, &pix, NULL, &attr); |
411 XpmFreeAttributes(&attr); | 409 XpmFreeAttributes(&attr); |
437 XCopyArea(dpy, pix, arm_pix, gc, 0, 0, width, height, 2 * shift, 2 * shift); | 435 XCopyArea(dpy, pix, arm_pix, gc, 0, 0, width, height, 2 * shift, 2 * shift); |
438 | 436 |
439 XFreePixmap(dpy, pix); | 437 XFreePixmap(dpy, pix); |
440 XFreePixmap(dpy, mask); | 438 XFreePixmap(dpy, mask); |
441 | 439 |
442 /* Create the "insensitive" pixmap. */ | 440 // Create the "insensitive" pixmap. |
443 attr.valuemask = XpmColorSymbols | XpmCloseness | XpmColorKey; | 441 attr.valuemask = XpmColorSymbols | XpmCloseness | XpmColorKey; |
444 attr.closeness = 65535; /* accuracy isn't crucial */ | 442 attr.closeness = 65535; // accuracy isn't crucial |
445 attr.colorsymbols = color; | 443 attr.colorsymbols = color; |
446 attr.numsymbols = sizeof(color) / sizeof(color[0]); | 444 attr.numsymbols = sizeof(color) / sizeof(color[0]); |
447 attr.color_key = XPM_MONO; | 445 attr.color_key = XPM_MONO; |
448 status = XpmCreatePixmapFromData(dpy, root, data, &pix, &mask, &attr); | 446 status = XpmCreatePixmapFromData(dpy, root, data, &pix, &mask, &attr); |
449 | 447 |
450 /* Need to create new Pixmaps with the mask applied. */ | 448 // Need to create new Pixmaps with the mask applied. |
451 | 449 |
452 ins_pix = XCreatePixmap(dpy, root, width + shift, height + shift, depth); | 450 ins_pix = XCreatePixmap(dpy, root, width + shift, height + shift, depth); |
453 | 451 |
454 XSetForeground(dpy, gc, eb->core.background_pixel); | 452 XSetForeground(dpy, gc, eb->core.background_pixel); |
455 XSetClipOrigin(dpy, gc, 0, 0); | 453 XSetClipOrigin(dpy, gc, 0, 0); |
564 | 562 |
565 if (((UnhighlightT = (XmSpecifyUnhighlightTrait) XmeTraitGet((XtPointer) | 563 if (((UnhighlightT = (XmSpecifyUnhighlightTrait) XmeTraitGet((XtPointer) |
566 XtClass(eb->core.parent), XmQTspecifyUnhighlight)) | 564 XtClass(eb->core.parent), XmQTspecifyUnhighlight)) |
567 != NULL) && (UnhighlightT->getUnhighlightGC != NULL)) | 565 != NULL) && (UnhighlightT->getUnhighlightGC != NULL)) |
568 { | 566 { |
569 /* if unhighlight trait in parent use specified GC... */ | 567 // if unhighlight trait in parent use specified GC... |
570 manager_background_GC = | 568 manager_background_GC = |
571 UnhighlightT->getUnhighlightGC(eb->core.parent, (Widget) eb); | 569 UnhighlightT->getUnhighlightGC(eb->core.parent, (Widget) eb); |
572 } | 570 } |
573 else | 571 else |
574 { | 572 { |
575 /* ...otherwise, use parent's background GC */ | 573 // ...otherwise, use parent's background GC |
576 manager_background_GC = ((XmManagerWidget) | 574 manager_background_GC = ((XmManagerWidget) |
577 (eb->core.parent))->manager.background_GC; | 575 (eb->core.parent))->manager.background_GC; |
578 } | 576 } |
579 #else | 577 #else |
580 manager_background_GC = ((XmManagerWidget) | 578 manager_background_GC = ((XmManagerWidget) |
694 eb->label.pixmap = eb->pushbutton.arm_pixmap; | 692 eb->label.pixmap = eb->pushbutton.arm_pixmap; |
695 else | 693 else |
696 eb->label.pixmap = eb->pushbutton.unarm_pixmap; | 694 eb->label.pixmap = eb->pushbutton.unarm_pixmap; |
697 } | 695 } |
698 else | 696 else |
699 /* pushbutton is not armed */ | 697 // pushbutton is not armed |
700 eb->label.pixmap = eb->pushbutton.unarm_pixmap; | 698 eb->label.pixmap = eb->pushbutton.unarm_pixmap; |
701 } | 699 } |
702 | 700 |
703 /* | 701 /* |
704 * Temporarily remove the Xm3D_ENHANCE_PIXEL hack ("adjustment") from the | 702 * Temporarily remove the Xm3D_ENHANCE_PIXEL hack ("adjustment") from the |
756 #endif | 754 #endif |
757 | 755 |
758 if (eb->pushbutton.armed) | 756 if (eb->pushbutton.armed) |
759 return; | 757 return; |
760 | 758 |
761 /* ...so KHelp event is delivered correctly. */ | 759 // ...so KHelp event is delivered correctly. |
762 _XmSetFocusFlag(XtParent(XtParent(eb)), XmFOCUS_IGNORE, TRUE); | 760 _XmSetFocusFlag(XtParent(XtParent(eb)), XmFOCUS_IGNORE, TRUE); |
763 XtSetKeyboardFocus(XtParent(XtParent(eb)), (Widget) eb); | 761 XtSetKeyboardFocus(XtParent(XtParent(eb)), (Widget) eb); |
764 _XmSetFocusFlag(XtParent(XtParent(eb)), XmFOCUS_IGNORE, FALSE); | 762 _XmSetFocusFlag(XtParent(XtParent(eb)), XmFOCUS_IGNORE, FALSE); |
765 | 763 |
766 eb->pushbutton.armed = TRUE; | 764 eb->pushbutton.armed = TRUE; |
767 | 765 |
768 ((XmManagerWidget) XtParent(wid))->manager.active_child = wid; | 766 ((XmManagerWidget) XtParent(wid))->manager.active_child = wid; |
769 | 767 |
770 /* etched in menu button */ | 768 // etched in menu button |
771 if (etched_in && !XmIsTearOffButton(eb)) | 769 if (etched_in && !XmIsTearOffButton(eb)) |
772 { | 770 { |
773 XFillRectangle(XtDisplay(eb), XtWindow(eb), | 771 XFillRectangle(XtDisplay(eb), XtWindow(eb), |
774 eb->pushbutton.fill_gc, | 772 eb->pushbutton.fill_gc, |
775 0, 0, eb->core.width, eb->core.height); | 773 0, 0, eb->core.width, eb->core.height); |
841 Boolean etched_in = False; | 839 Boolean etched_in = False; |
842 #endif | 840 #endif |
843 | 841 |
844 if (_XmGetInDragMode((Widget)eb) | 842 if (_XmGetInDragMode((Widget)eb) |
845 && eb->pushbutton.armed | 843 && eb->pushbutton.armed |
846 && ( /* !ActiveTearOff || */ | 844 && ( // !ActiveTearOff || |
847 event->xcrossing.mode == NotifyNormal)) | 845 event->xcrossing.mode == NotifyNormal)) |
848 { | 846 { |
849 eb->pushbutton.armed = FALSE; | 847 eb->pushbutton.armed = FALSE; |
850 | 848 |
851 ((XmManagerWidget) XtParent(wid))->manager.active_child = NULL; | 849 ((XmManagerWidget) XtParent(wid))->manager.active_child = NULL; |
913 unsigned int w = 0; | 911 unsigned int w = 0; |
914 unsigned int h = 0; | 912 unsigned int h = 0; |
915 | 913 |
916 _XmCalcLabelDimensions((Widget) newtb); | 914 _XmCalcLabelDimensions((Widget) newtb); |
917 | 915 |
918 /* Find out how big the pixmap is */ | 916 // Find out how big the pixmap is |
919 if (newtb->enhancedbutton.pixmap_data | 917 if (newtb->enhancedbutton.pixmap_data |
920 && !IsNull(newtb->label.pixmap) | 918 && !IsNull(newtb->label.pixmap) |
921 && !IsNull(newtb->enhancedbutton.normal_pixmap)) | 919 && !IsNull(newtb->enhancedbutton.normal_pixmap)) |
922 { | 920 { |
923 w = newtb->enhancedbutton.pixmap_width; | 921 w = newtb->enhancedbutton.pixmap_width; |
956 + newtb->primitive.highlight_thickness | 954 + newtb->primitive.highlight_thickness |
957 + newtb->label.margin_height); | 955 + newtb->label.margin_height); |
958 } | 956 } |
959 else | 957 else |
960 { | 958 { |
961 /* FIXME: We should calculate an drawing offset for the pixmap here to | 959 // FIXME: We should calculate an drawing offset for the pixmap here to |
962 * adjust it. */ | 960 // adjust it. |
963 } | 961 } |
964 | 962 |
965 #if 0 | 963 #if 0 |
966 printf("%d %d %d %d %d %d - %d %d\n", newtb->enhancedbutton.normal_pixmap, | 964 printf("%d %d %d %d %d %d - %d %d\n", newtb->enhancedbutton.normal_pixmap, |
967 h, newtb->core.height, | 965 h, newtb->core.height, |
970 newtb->label.margin_height, | 968 newtb->label.margin_height, |
971 newtb->core.width, | 969 newtb->core.width, |
972 newtb->core.height); | 970 newtb->core.height); |
973 #endif | 971 #endif |
974 | 972 |
975 /* Invoke Label's Resize procedure. */ | 973 // Invoke Label's Resize procedure. |
976 { | 974 { |
977 XtWidgetProc resize; | 975 XtWidgetProc resize; |
978 XtProcessLock(); | 976 XtProcessLock(); |
979 resize = xmLabelClassRec.core_class.resize; | 977 resize = xmLabelClassRec.core_class.resize; |
980 XtProcessUnlock(); | 978 XtProcessUnlock(); |
992 | 990 |
993 XtProcessLock(); | 991 XtProcessLock(); |
994 resize = xmLabelClassRec.core_class.resize; | 992 resize = xmLabelClassRec.core_class.resize; |
995 XtProcessUnlock(); | 993 XtProcessUnlock(); |
996 | 994 |
997 /* Create a bitmap for stippling (Drawable resources are cheap). */ | 995 // Create a bitmap for stippling (Drawable resources are cheap). |
998 if (STIPPLE_BITMAP == None) | 996 if (STIPPLE_BITMAP == None) |
999 { | 997 { |
1000 Display *dpy = XtDisplay((Widget) request); | 998 Display *dpy = XtDisplay((Widget) request); |
1001 Window rootW = DefaultRootWindow(dpy); | 999 Window rootW = DefaultRootWindow(dpy); |
1002 | 1000 |
1003 STIPPLE_BITMAP = XCreateBitmapFromData(dpy, rootW, stipple_bits, | 1001 STIPPLE_BITMAP = XCreateBitmapFromData(dpy, rootW, stipple_bits, |
1004 stipple_width, stipple_height); | 1002 stipple_width, stipple_height); |
1005 } | 1003 } |
1006 eb->enhancedbutton.doing_setvalues = False; | 1004 eb->enhancedbutton.doing_setvalues = False; |
1007 | 1005 |
1008 /* First see what type of extended label this is. | 1006 // First see what type of extended label this is. |
1009 */ | |
1010 if (eb->enhancedbutton.pixmap_data) | 1007 if (eb->enhancedbutton.pixmap_data) |
1011 { | 1008 { |
1012 XmString str; | 1009 XmString str; |
1013 set_pixmap(eb); | 1010 set_pixmap(eb); |
1014 | 1011 |
1015 /* FIXME: this is not the perfect way to deal with menus, which do not | 1012 // FIXME: this is not the perfect way to deal with menus, which do not |
1016 * have any string set right now. */ | 1013 // have any string set right now. |
1017 str = XmStringCreateLocalized(""); | 1014 str = XmStringCreateLocalized(""); |
1018 XtVaSetValues((Widget) eb, XmNlabelString, str, NULL); | 1015 XtVaSetValues((Widget) eb, XmNlabelString, str, NULL); |
1019 XmStringFree(str); | 1016 XmStringFree(str); |
1020 } | 1017 } |
1021 eb->label.pixmap = eb->enhancedbutton.normal_pixmap; | 1018 eb->label.pixmap = eb->enhancedbutton.normal_pixmap; |
1104 unsigned int mask; | 1101 unsigned int mask; |
1105 | 1102 |
1106 /* | 1103 /* |
1107 * Artificially let the highlight appear if the mouse is over us. | 1104 * Artificially let the highlight appear if the mouse is over us. |
1108 */ | 1105 */ |
1109 /* Best way to get the root window of object: */ | 1106 // Best way to get the root window of object: |
1110 XGetGeometry(dpy, XtWindow(cur), &root, &r_x, &r_y, &r_width, | 1107 XGetGeometry(dpy, XtWindow(cur), &root, &r_x, &r_y, &r_width, |
1111 &r_height, &r_border, &r_depth); | 1108 &r_height, &r_border, &r_depth); |
1112 XQueryPointer(XtDisplay(cur), XtWindow(cur), &root_q, &child, | 1109 XQueryPointer(XtDisplay(cur), XtWindow(cur), &root_q, &child, |
1113 &root_x, &root_y, &win_x, &win_y, &mask); | 1110 &root_x, &root_y, &win_x, &win_y, &mask); |
1114 | 1111 |
1131 * Check for changed ExtLabelString. | 1128 * Check for changed ExtLabelString. |
1132 */ | 1129 */ |
1133 if (NOT_EQUAL(primitive.shadow_thickness)) | 1130 if (NOT_EQUAL(primitive.shadow_thickness)) |
1134 { | 1131 { |
1135 redraw = True; | 1132 redraw = True; |
1136 /* Don't change the pixmaps */ | 1133 // Don't change the pixmaps |
1137 change = False; | 1134 change = False; |
1138 } | 1135 } |
1139 | 1136 |
1140 if (NOT_EQUAL(primitive.foreground)) | 1137 if (NOT_EQUAL(primitive.foreground)) |
1141 redraw = True; | 1138 redraw = True; |
1228 */ | 1225 */ |
1229 if (!Lab_IsMenupane(eb)) | 1226 if (!Lab_IsMenupane(eb)) |
1230 { | 1227 { |
1231 GC gc; | 1228 GC gc; |
1232 | 1229 |
1233 /* Don't shade if the button contains a label with a pixmap, since | 1230 // Don't shade if the button contains a label with a pixmap, since |
1234 * there is no variant of the label available with the needed | 1231 // there is no variant of the label available with the needed |
1235 * background. | 1232 // background. |
1236 */ | |
1237 if (eb->pushbutton.armed && eb->pushbutton.fill_on_arm) | 1233 if (eb->pushbutton.armed && eb->pushbutton.fill_on_arm) |
1238 { | 1234 { |
1239 if (eb->label.label_type == (int)XmPIXMAP) | 1235 if (eb->label.label_type == (int)XmPIXMAP) |
1240 { | 1236 { |
1241 if (eb->pushbutton.arm_pixmap != XmUNSPECIFIED_PIXMAP) | 1237 if (eb->pushbutton.arm_pixmap != XmUNSPECIFIED_PIXMAP) |
1246 else | 1242 else |
1247 gc = eb->pushbutton.fill_gc; | 1243 gc = eb->pushbutton.fill_gc; |
1248 } | 1244 } |
1249 else | 1245 else |
1250 gc = eb->pushbutton.background_gc; | 1246 gc = eb->pushbutton.background_gc; |
1251 /* really need to fill with background if not armed ? */ | 1247 // really need to fill with background if not armed ? |
1252 if (gc) | 1248 if (gc) |
1253 XFillRectangle(XtDisplay(eb), XtWindow(eb), gc, | 1249 XFillRectangle(XtDisplay(eb), XtWindow(eb), gc, |
1254 box.x, box.y, box.width, box.height); | 1250 box.x, box.y, box.width, box.height); |
1255 } | 1251 } |
1256 | 1252 |
1316 | 1312 |
1317 #if !defined(LESSTIF_VERSION) && (XmVersion > 1002) | 1313 #if !defined(LESSTIF_VERSION) && (XmVersion > 1002) |
1318 switch (default_button_emphasis) | 1314 switch (default_button_emphasis) |
1319 { | 1315 { |
1320 case XmINTERNAL_HIGHLIGHT: | 1316 case XmINTERNAL_HIGHLIGHT: |
1321 /* The call above erases the border highlighting. */ | 1317 // The call above erases the border highlighting. |
1322 if (eb->primitive.highlight_drawn) | 1318 if (eb->primitive.highlight_drawn) |
1323 (*(((XmPushButtonWidgetClass) XtClass (eb)) | 1319 (*(((XmPushButtonWidgetClass) XtClass (eb)) |
1324 ->primitive_class.border_highlight)) ((Widget) eb) ; | 1320 ->primitive_class.border_highlight)) ((Widget) eb) ; |
1325 break; | 1321 break; |
1326 | 1322 |
1366 * May need more complex computation for getting the GCs. | 1362 * May need more complex computation for getting the GCs. |
1367 */ | 1363 */ |
1368 parent = XtParent(eb); | 1364 parent = XtParent(eb); |
1369 if (XmIsManager(parent)) | 1365 if (XmIsManager(parent)) |
1370 { | 1366 { |
1371 /* Use the parent's GC so monochrome works. */ | 1367 // Use the parent's GC so monochrome works. |
1372 bottom_gc = XmParentTopShadowGC(eb); | 1368 bottom_gc = XmParentTopShadowGC(eb); |
1373 top_gc = XmParentBottomShadowGC(eb); | 1369 top_gc = XmParentBottomShadowGC(eb); |
1374 } | 1370 } |
1375 else | 1371 else |
1376 { | 1372 { |
1377 /* Use your own pixel for drawing. */ | 1373 // Use your own pixel for drawing. |
1378 bottom_gc = eb->primitive.top_shadow_GC; | 1374 bottom_gc = eb->primitive.top_shadow_GC; |
1379 top_gc = eb->primitive.bottom_shadow_GC; | 1375 top_gc = eb->primitive.bottom_shadow_GC; |
1380 } | 1376 } |
1381 | 1377 |
1382 if ((bottom_gc == None) || (top_gc == None)) | 1378 if ((bottom_gc == None) || (top_gc == None)) |
1445 | 1441 |
1446 (*(xmPushButtonClassRec.primitive_class.border_unhighlight))(w); | 1442 (*(xmPushButtonClassRec.primitive_class.border_unhighlight))(w); |
1447 draw_pixmap(eb, NULL, NULL); | 1443 draw_pixmap(eb, NULL, NULL); |
1448 } | 1444 } |
1449 | 1445 |
1450 #endif /* FEAT_TOOLBAR */ | 1446 #endif // FEAT_TOOLBAR |