/* * status.c -- dtbar: volume, Bluetooth, network and battery at the right of * the bar * * License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. * * Small menus with an icon each, left of the clock -- the battery only on a * machine that has one. What they show and change goes through McdeSys (the * volume of the default output, the first Bluetooth controller, the network * interfaces, the batteries): dtbar itself never runs a * system tool. The icons follow the state every ten seconds; a menu reads * the state anew when it opens. The wheel over the speaker turns the volume. * * The menus keep their entries and change only their labels: a pulldown that * gets new children while Motif posts it closes again. * * C99, POSIX, Xt and Motif only (ext/src/mcde/AGENTS.md). */ #define _POSIX_C_SOURCE 200809L #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "dtbar.h" /* ---- the icons: 16x16 icon files of CDE's kind (icons/Mcde*.t.pm, in * appconfig/icons/C), loaded by XmGetPixmap: Motif then knows their size -- * a pixmap made here was sized 10 pixels wide by the menu bar under dtwm */ static Pixmap Icon(Widget w, const char *name) { char path[512]; Pixel fg, bg; Pixmap pm; /* "None" in the file becomes the bar's background (XmGetPixmap); W is * a gadget, with no screen of its own (XtScreen would crash) */ XtVaGetValues(XtIsWidget(w) ? w : XtParent(w), XmNforeground, &fg, XmNbackground, &bg, NULL); snprintf(path, sizeof path, "%s/appconfig/icons/C/%s.t.pm", CDE_INSTALLATION_TOP, name); pm = XmGetPixmap(XtScreenOfObject(w), path, fg, bg); if (pm == XmUNSPECIFIED_PIXMAP) fprintf(stderr, "dtbar: no icon %s\n", path); return pm; } static void SetIcon(Widget cascade, Pixmap *cache, const char *name, const char **shown) { if (*shown != NULL && strcmp(*shown, name) == 0) return; if (*cache == None) *cache = Icon(cascade, name); XtVaSetValues(cascade, XmNlabelType, XmPIXMAP, XmNlabelPixmap, *cache, NULL); *shown = name; } /* ---- the widgets -------------------------------------------------------- */ #define NET_SLOTS 6 static Widget volCascade, volLabel, volScale, volMute; static Widget btCascade, btLabel, btPower; static Widget netCascade, netLabels[NET_SLOTS]; static Widget batCascade, batLabel, batSource, batTime, statusBar; static Widget dispCascade, dispCount, dispLine[4], dispModes; static Widget userCascade, searchButton; static Pixmap pmUser, pmSearch; static const char *userShown, *searchShown; static Widget dispModeItem[8]; static Pixmap pmDisp; static const char *dispShown; static McdeDispSet dispBefore; static Boolean dispPending; static XtIntervalId dispTimer; static Widget dispAsk; static Pixmap pmHigh, pmLow, pmMuted, pmBtOn, pmBtOff, pmWifi, pmWired, pmNetOff; static Pixmap pmBatFull, pmBatHalf, pmBatLow, pmBatCharging; static const char *volShown, *btShown, *netShown, *batShown; static int volume = -1, muted; static McdeSysBluetooth bt; static void Label(Widget w, const char *text) { XmString s = XmStringCreateLocalized((char *) text); XtVaSetValues(w, XmNlabelString, s, NULL); XmStringFree(s); } static Widget Item(Widget menu, WidgetClass class, const char *text) { XmString s = XmStringCreateLocalized((char *) text); Widget w = XtVaCreateManagedWidget("item", class, menu, XmNlabelString, s, XmNalignment, XmALIGNMENT_BEGINNING, NULL); XmStringFree(s); return w; } /* ---- volume ------------------------------------------------------------- */ static void VolumeIcon(void) { if (volume < 0 || muted || volume == 0) SetIcon(volCascade, &pmMuted, "McdeVolumeMuted", &volShown); else if (volume < 50) SetIcon(volCascade, &pmLow, "McdeVolumeLow", &volShown); else SetIcon(volCascade, &pmHigh, "McdeVolumeHigh", &volShown); } static void ReadVolume(void) { char text[64]; if (mcde_sys_volume_get(&volume, &muted) != MCDE_SYS_OK) { volume = -1; Label(volLabel, "No sound output"); XtSetSensitive(volScale, False); XtSetSensitive(volMute, False); } else { snprintf(text, sizeof text, "Volume: %d %%", volume); Label(volLabel, text); XtSetSensitive(volScale, True); XtSetSensitive(volMute, True); XmScaleSetValue(volScale, volume > 100 ? 100 : volume); XmToggleButtonGadgetSetState(volMute, muted, False); } VolumeIcon(); } static void VolumeChanged(Widget w, XtPointer data, XtPointer call) { XmScaleCallbackStruct *cbs = (XmScaleCallbackStruct *) call; char text[64]; (void) w; (void) data; if (mcde_sys_volume_set(cbs->value) == MCDE_SYS_OK) { volume = cbs->value; snprintf(text, sizeof text, "Volume: %d %%", volume); Label(volLabel, text); VolumeIcon(); } } static void MuteChanged(Widget w, XtPointer data, XtPointer call) { XmToggleButtonCallbackStruct *cbs = (XmToggleButtonCallbackStruct *) call; (void) w; (void) data; if (mcde_sys_volume_mute(cbs->set) == MCDE_SYS_OK) muted = cbs->set; VolumeIcon(); } /* the wheel over the speaker: five steps a click */ static void Wheel(Widget w, XtPointer data, XEvent *ev, Boolean *cont) { int v; (void) w; (void) data; (void) cont; if (ev->type != ButtonPress || (ev->xbutton.button != Button4 && ev->xbutton.button != Button5)) return; if (!XtIsManaged(volCascade)) return; /* over the speaker only (the cascades are gadgets of the bar) */ { Position x = 0; Dimension width = 0; XtVaGetValues(volCascade, XmNx, &x, XmNwidth, &width, NULL); if (ev->xbutton.x < x || ev->xbutton.x >= x + (int) width) return; } if (volume < 0) ReadVolume(); if (volume < 0) return; v = volume + (ev->xbutton.button == Button4 ? 5 : -5); if (v < 0) v = 0; if (v > 100) v = 100; if (mcde_sys_volume_set(v) == MCDE_SYS_OK) volume = v; VolumeIcon(); } /* ---- Bluetooth ---------------------------------------------------------- */ static void ReadBluetooth(void) { (void) mcde_sys_bluetooth(&bt); if (!bt.present) { Label(btLabel, "No Bluetooth controller"); Label(btPower, "Turn Bluetooth On"); XtSetSensitive(btPower, False); } else { Label(btLabel, bt.on ? "Bluetooth: On" : "Bluetooth: Off"); Label(btPower, bt.on ? "Turn Bluetooth Off" : "Turn Bluetooth On"); XtSetSensitive(btPower, True); } if (bt.present && bt.on) SetIcon(btCascade, &pmBtOn, "McdeBluetoothOn", &btShown); else SetIcon(btCascade, &pmBtOff, "McdeBluetoothOff", &btShown); } static void BluetoothPower(Widget w, XtPointer data, XtPointer call) { (void) w; (void) data; (void) call; if (mcde_sys_bluetooth_power(!bt.on) != MCDE_SYS_OK) ShowMessage("Bluetooth", mcde_sys_error(), 1); ReadBluetooth(); } /* ---- network ------------------------------------------------------------ */ static void ReadNetwork(void) { McdeSysInterface ifs[32]; int n = mcde_sys_interfaces(ifs, 32), i, slot = 0; int wifiUp = 0, wiredUp = 0; char text[160]; for (i = 0; i < n && slot < NET_SLOTS; i++) { const McdeSysInterface *it = &ifs[i]; /* the network cards, not bridges, tunnels and containers */ if (it->kind == MCDE_NET_OTHER) continue; if (it->kind == MCDE_NET_WIFI) { if (it->up) snprintf(text, sizeof text, "Wi-Fi (%s): %s%s%s", it->name, it->ssid[0] != '\0' ? it->ssid : "", it->ssid[0] != '\0' ? ", " : "", it->address); else snprintf(text, sizeof text, "Wi-Fi (%s): not connected", it->name); wifiUp |= it->up; } else { if (it->up) snprintf(text, sizeof text, "Ethernet (%s): %s", it->name, it->address); else snprintf(text, sizeof text, "Ethernet (%s): no cable", it->name); wiredUp |= it->up; } Label(netLabels[slot], text); XtManageChild(netLabels[slot]); slot++; } if (slot == 0) { Label(netLabels[0], "No network"); XtManageChild(netLabels[0]); slot = 1; } for (; slot < NET_SLOTS; slot++) XtUnmanageChild(netLabels[slot]); if (wiredUp) SetIcon(netCascade, &pmWired, "McdeWired", &netShown); else if (wifiUp) SetIcon(netCascade, &pmWifi, "McdeWifi", &netShown); else SetIcon(netCascade, &pmNetOff, "McdeNetworkOff", &netShown); } /* ---- displays ----------------------------------------------------------- */ #define DISP_LINES 4 /* what RandR says now: each monitor with its size, and the modes of the * first one (the pane on the right changes them) */ static void ReadDisplays(void) { McdeDispSet set; char text[160], modes[512]; int i, w, h; size_t at = 0; if (McdeDispLoad(XtDisplay(dispCascade), &set) < 0) { Label(dispCount, "Displays: RandR is not there"); for (i = 0; i < DISP_LINES; i++) XtUnmanageChild(dispLine[i]); Label(dispModes, ""); return; } (void)snprintf(text, sizeof text, "%d display%s", set.n, set.n == 1 ? "" : "s"); Label(dispCount, text); for (i = 0; i < DISP_LINES; i++) { if (i >= set.n || i >= MCDE_DISP_MAX) { XtUnmanageChild(dispLine[i]); continue; } McdeDispSize(&set.d[i], &w, &h); (void)snprintf(text, sizeof text, "%s: %dx%d%s%s", set.d[i].name[0] != '\0' ? set.d[i].name : "display", w, h, set.d[i].primary ? ", primary" : "", set.d[i].on ? "" : " (off)"); Label(dispLine[i], text); XtManageChild(dispLine[i]); } modes[0] = '\0'; for (i = 0; i < 8; i++) { if (set.n > 0 && i < set.d[0].nmodes) { McdeDispMode *md = &set.d[0].modes[i]; int cur = md->w == set.d[0].w && md->h == set.d[0].h; (void)snprintf(text, sizeof text, "%s%d x %d, %.0f Hz", cur ? "* " : " ", md->w, md->h, md->rate); Label(dispModeItem[i], text); XmToggleButtonSetState(dispModeItem[i], cur, False); XtManageChild(dispModeItem[i]); } else XtUnmanageChild(dispModeItem[i]); } Label(dispModes, ""); } /* the magnifier: the launcher, as Command+space opens it */ static void SearchCB(Widget w, XtPointer data, XtPointer call) { (void) w; (void) data; (void) call; RunCommand("dtlaunch -show"); } static void DetectDisplays(Widget w, XtPointer data, XtPointer call) { (void) w; (void) data; (void) call; ReadDisplays(); /* what ~/.dt/displays says, as at login (Xsession.d/0071.displays) */ RunCommand("dtsystemsettings -apply-displays"); } /* a mode chosen: on, with the question; after 15 s without an answer the * displays go back (the pane asks the same way, displays.c) */ static void DisplaysBack(XtPointer data, XtIntervalId *id) { (void) data; (void) id; dispTimer = 0; if (!dispPending) return; if (dispAsk != NULL) { XtDestroyWidget(XtParent(dispAsk)); dispAsk = NULL; } (void) McdeDispApply(XtDisplay(dispCascade), &dispBefore); dispPending = False; ReadDisplays(); } static void DisplaysRevertCB(Widget w, XtPointer data, XtPointer call) { (void) w; (void) data; (void) call; DisplaysBack(NULL, NULL); } static void DisplaysKeep(Widget w, XtPointer data, XtPointer call) { (void) w; (void) data; (void) call; if (dispTimer != 0) XtRemoveTimeOut(dispTimer); dispTimer = 0; dispPending = False; if (dispAsk != NULL) { XtDestroyWidget(XtParent(dispAsk)); dispAsk = NULL; } } static void ModeChosen(Widget w, XtPointer data, XtPointer call) { McdeDispSet set; int idx = (int) (size_t) data; char text[160]; (void) w; (void) call; if (idx < 0 || idx >= 8) return; if (McdeDispLoad(XtDisplay(dispCascade), &set) < 0 || set.n < 1) return; if (idx >= set.d[0].nmodes) return; dispBefore = set; set.d[0].w = set.d[0].modes[idx].w; set.d[0].h = set.d[0].modes[idx].h; set.d[0].rate = set.d[0].modes[idx].rate; if (McdeDispApply(XtDisplay(dispCascade), &set) != 0) { Label(dispCount, "That display mode did not take."); return; } dispPending = True; ReadDisplays(); { XmString m = XmStringCreateLocalized("Keep these display " "settings? Without an answer they go back in 15 seconds."); XmString ok = XmStringCreateLocalized((char *) "Keep"); XmString cancel = XmStringCreateLocalized((char *) "Revert"); Arg a[6]; int n = 0; XtSetArg(a[n], XmNmessageString, m); n++; XtSetArg(a[n], XmNokLabelString, ok); n++; XtSetArg(a[n], XmNcancelLabelString, cancel); n++; XtSetArg(a[n], XmNautoUnmanage, False); n++; XtSetArg(a[n], XmNdialogTitle, XmStringCreateLocalized( (char *) "Display Settings")); n++; dispAsk = XmCreateQuestionDialog(XtParent(dispCascade), "keep", a, n); XmStringFree(m); XmStringFree(ok); XmStringFree(cancel); XtUnmanageChild(XmMessageBoxGetChild(dispAsk, XmDIALOG_HELP_BUTTON)); XtAddCallback(dispAsk, XmNokCallback, DisplaysKeep, NULL); XtAddCallback(dispAsk, XmNcancelCallback, DisplaysRevertCB, NULL); XtManageChild(dispAsk); Centre(dispAsk); dispTimer = XtAppAddTimeOut(XtWidgetToApplicationContext( dispCascade), 15000, DisplaysBack, NULL); } (void)snprintf(text, sizeof text, "Mode %d x %d applied.", set.d[0].w, set.d[0].h); Label(dispCount, text); } /* ---- battery ------------------------------------------------------------ */ /* the bar is as wide as its icons (MakeStatus) */ static void StatusWidth(void) { int icons = (XtIsManaged(batCascade) ? 5 : 4) + 2 - (XtIsManaged(volCascade) ? 0 : 1); XtVaSetValues(statusBar, XmNwidth, icons * 30 + 12, NULL); } static void ReadBattery(void) { McdeSysBattery b; char text[64]; (void) mcde_sys_battery(&b); if (!b.present) { if (XtIsManaged(batCascade)) { XtUnmanageChild(batCascade); StatusWidth(); } return; } if (b.charging) snprintf(text, sizeof text, "Battery: %d%%, charging", b.percent); else if (b.ac && b.percent >= 99) snprintf(text, sizeof text, "Battery: charged"); else snprintf(text, sizeof text, "Battery: %d%%", b.percent); Label(batLabel, text); Label(batSource, b.ac ? "Power Source: Power Adapter" : "Power Source: Battery"); if (b.minutes >= 0) { snprintf(text, sizeof text, "%d:%02d remaining", b.minutes / 60, b.minutes % 60); Label(batTime, text); XtManageChild(batTime); } else XtUnmanageChild(batTime); if (b.charging) SetIcon(batCascade, &pmBatCharging, "McdeBatteryCharging", &batShown); else if (b.percent >= 67) SetIcon(batCascade, &pmBatFull, "McdeBatteryFull", &batShown); else if (b.percent >= 20) SetIcon(batCascade, &pmBatHalf, "McdeBatteryHalf", &batShown); else SetIcon(batCascade, &pmBatLow, "McdeBatteryLow", &batShown); if (!XtIsManaged(batCascade)) { XtManageChild(batCascade); StatusWidth(); } } /* ~/.dt/bar, written by System Settings > Sound: showvolume=0 hides the * speaker in the bar (it is read at start, as the bar reads its settings) */ static Boolean VolumeInBar(void) { char path[1024], line[128]; const char *home = getenv("HOME"); FILE *f; Boolean show = True; if (home == NULL || (size_t) snprintf(path, sizeof path, "%s/.dt/bar", home) >= sizeof path) return True; if ((f = fopen(path, "r")) == NULL) return True; while (fgets(line, sizeof line, f) != NULL) { line[strcspn(line, "\r\n")] = '\0'; if (strncmp(line, "showvolume=", 11) == 0) show = atoi(line + 11) != 0; } fclose(f); return show; } /* ---- the menus ---------------------------------------------------------- */ static void Opening(Widget w, XtPointer data, XtPointer call) { (void) w; (void) call; switch ((int) (size_t) data) { case 0: ReadVolume(); break; case 1: ReadBluetooth(); break; case 2: ReadNetwork(); break; case 4: ReadDisplays(); break; case 3: ReadBattery(); break; } } /* the cascade gets its first icon when it is made: Motif sizes a label in * Initialize, and a pixmap set later left the button 10 pixels wide */ static Widget Menu(Widget bar, const char *name, Widget *pulldown, int which, Pixmap *cache, const char *icon, const char **shown) { Widget c; *pulldown = XmCreatePulldownMenu(bar, (char *) name, NULL, 0); *cache = Icon(bar, icon); *shown = icon; c = XtVaCreateManagedWidget(name, xmCascadeButtonWidgetClass, bar, XmNsubMenuId, *pulldown, XmNlabelType, XmPIXMAP, XmNlabelPixmap, *cache, NULL); XtAddCallback(c, XmNcascadingCallback, Opening, (XtPointer) (size_t) which); return c; } static void OpenSettings(Widget w, XtPointer data, XtPointer call) { (void) w; (void) call; RunCommand((const char *) data); } /* "... Settings...": the pane of dtsystemsettings */ static void Settings(Widget menu, const char *label, const char *command) { Widget b = Item(menu, xmPushButtonGadgetClass, label); XtAddCallback(b, XmNactivateCallback, OpenSettings, (XtPointer) command); } static void Poll(XtPointer data, XtIntervalId *id) { (void) id; ReadVolume(); ReadBluetooth(); ReadNetwork(); ReadBattery(); XtAppAddTimeOut((XtAppContext) data, 10000, Poll, data); } Widget MakeStatus(Widget parent) { Widget bar = statusBar = XmCreateMenuBar(parent, "status", NULL, 0); Widget m; int i; XtVaSetValues(bar, XmNshadowThickness, 0, XmNmarginHeight, 0, NULL); volCascade = Menu(bar, "volume", &m, 0, &pmMuted, "McdeVolumeMuted", &volShown); volLabel = Item(m, xmLabelGadgetClass, "Volume"); { Arg a[6]; Cardinal n = 0; /* a slider Motif takes as a menu entry (menuscale.c) */ XtSetArg(a[n], XmNorientation, XmHORIZONTAL); n++; XtSetArg(a[n], XmNminimum, 0); n++; XtSetArg(a[n], XmNmaximum, 100); n++; XtSetArg(a[n], XmNshowValue, False); n++; XtSetArg(a[n], XmNscaleWidth, 180); n++; volScale = MenuScale(m, "scale", a, n); } XtAddCallback(volScale, XmNvalueChangedCallback, VolumeChanged, NULL); XtAddCallback(volScale, XmNdragCallback, VolumeChanged, NULL); volMute = Item(m, xmToggleButtonGadgetClass, "Mute"); XtVaSetValues(volMute, XmNvisibleWhenOff, True, NULL); XtAddCallback(volMute, XmNvalueChangedCallback, MuteChanged, NULL); XtVaCreateManagedWidget("sep", xmSeparatorGadgetClass, m, NULL); Settings(m, "Sound Settings...", "dtsystemsettings -pane sound"); XtAddEventHandler(bar, ButtonPressMask, False, Wheel, NULL); if (!VolumeInBar()) XtUnmanageChild(volCascade); btCascade = Menu(bar, "bluetooth", &m, 1, &pmBtOff, "McdeBluetoothOff", &btShown); btLabel = Item(m, xmLabelGadgetClass, "Bluetooth"); btPower = Item(m, xmPushButtonGadgetClass, "Turn Bluetooth Off"); XtAddCallback(btPower, XmNactivateCallback, BluetoothPower, NULL); XtVaCreateManagedWidget("sep", xmSeparatorGadgetClass, m, NULL); Settings(m, "Bluetooth Settings...", "dtsystemsettings -pane bluetooth"); netCascade = Menu(bar, "network", &m, 2, &pmNetOff, "McdeNetworkOff", &netShown); for (i = 0; i < NET_SLOTS; i++) netLabels[i] = Item(m, xmLabelGadgetClass, ""); XtVaCreateManagedWidget("sep", xmSeparatorGadgetClass, m, NULL); Settings(m, "Network Settings...", "dtsystemsettings -pane network"); dispCascade = Menu(bar, "displays", &m, 4, &pmDisp, "DtScrn", &dispShown); { Widget det = Item(m, xmPushButtonGadgetClass, "Detect Displays"); XtAddCallback(det, XmNactivateCallback, DetectDisplays, NULL); } XtVaCreateManagedWidget("sep", xmSeparatorGadgetClass, m, NULL); dispCount = Item(m, xmLabelGadgetClass, "Displays"); for (i = 0; i < DISP_LINES; i++) dispLine[i] = Item(m, xmLabelGadgetClass, ""); dispModes = Item(m, xmLabelGadgetClass, ""); for (i = 0; i < 8; i++) { dispModeItem[i] = Item(m, xmToggleButtonGadgetClass, ""); XtAddCallback(dispModeItem[i], XmNvalueChangedCallback, ModeChosen, (XtPointer) (size_t) i); } XtVaCreateManagedWidget("sep", xmSeparatorGadgetClass, m, NULL); Settings(m, "Displays Preferences...", "dtsystemsettings -pane " "displays"); /* hidden until a battery is found (ReadBattery) */ batCascade = Menu(bar, "battery", &m, 3, &pmBatFull, "McdeBatteryFull", &batShown); batLabel = Item(m, xmLabelGadgetClass, "Battery"); batSource = Item(m, xmLabelGadgetClass, "Power Source"); batTime = Item(m, xmLabelGadgetClass, ""); XtUnmanageChild(batCascade); /* the person: who is logged in, and the way to the accounts */ userCascade = Menu(bar, "user", &m, 6, &pmUser, "McdeUser", &userShown); { /* the login name: the passwd entry first (a session started * with an empty environment has no USER) */ const char *who = NULL; struct passwd *pw = getpwuid(geteuid()); if (pw != NULL) who = pw->pw_name; if (who == NULL) who = getenv("USER"); (void) Item(m, xmLabelGadgetClass, who != NULL && who[0] != '\0' ? who : "user"); } XtVaCreateManagedWidget("sep", xmSeparatorGadgetClass, m, NULL); Settings(m, "Accounts...", "dtsystemsettings -pane accounts"); Settings(m, "Log Out...", "dtbar -command logout"); /* the magnifier: a menu of its own -- the bar is a homogeneous menu * bar and takes only cascades (measured: a push button gadget there * is refused, "wrong child type") */ searchButton = Menu(bar, "search", &m, 7, &pmSearch, "McdeSearch", &searchShown); { Widget b = Item(m, xmPushButtonGadgetClass, "Launcher (Command+space)"); XtAddCallback(b, XmNactivateCallback, SearchCB, NULL); } XtVaCreateManagedWidget("sep", xmSeparatorGadgetClass, m, NULL); Settings(m, "Search Settings...", "dtsystemsettings"); /* as wide as its icons, fixed: the form gave the menu bar the width it * had before the icons were measured, and the bar squeezed its buttons * to 10 pixels (measured, MCDE_GLOBAL_MENU_DEBUG) */ XtVaSetValues(bar, XmNresizeWidth, False, NULL); StatusWidth(); XtManageChild(bar); return bar; } void StartStatus(XtAppContext app) { Poll((XtPointer) app, NULL); if (getenv("MCDE_GLOBAL_MENU_DEBUG")) { fprintf(stderr, "dtbar: volume %d muted %d (%s)\n", volume, muted, volume < 0 ? mcde_sys_error() : "ok"); { Dimension h = 0; XtVaGetValues(XtParent(volCascade), XmNheight, &h, NULL); fprintf(stderr, "dtbar: status bar height %u\n", h); } Widget c[3]; int i; c[0] = volCascade; c[1] = btCascade; c[2] = netCascade; for (i = 0; i < 3; i++) { Dimension w = 0, h = 0; Pixmap pm = None; unsigned char type = 0; XtVaGetValues(c[i], XmNwidth, &w, XmNheight, &h, XmNlabelPixmap, &pm, XmNlabelType, &type, NULL); fprintf(stderr, "dtbar: %s %ux%u pixmap 0x%lx type %d " "managed %d\n", XtName(c[i]), w, h, (unsigned long) pm, type, XtIsManaged(c[i])); } } }