void W_BalloonHandleEnterView(WMView * view) { Balloon *bPtr = view->screen->balloon; char *text; if (!bPtr->flags.enabled) return; text = WMHashGet(bPtr->table, view); if (!text) { if (bPtr->view->flags.realized) W_UnmapView(bPtr->view); return; } if (bPtr->timer) WMDeleteTimerHandler(bPtr->timer); bPtr->timer = NULL; if (bPtr->noDelayTimer) WMDeleteTimerHandler(bPtr->noDelayTimer); bPtr->noDelayTimer = NULL; bPtr->forWindow = view->window; if (bPtr->flags.noDelay) { bPtr->timer = NULL; showBalloon(view); } else { bPtr->timer = WMAddTimerHandler(bPtr->delay, showBalloon, view); } }
static void miniwindowBalloon(WObjDescriptor *object) { WIcon *icon = (WIcon *) object->parent; WScreen *scr = icon->core->screen_ptr; if (!icon->icon_name) { wBalloonHide(scr); return; } scr->balloon->h = icon->core->height; scr->balloon->text = wstrdup(icon->icon_name); scr->balloon->apercu = icon->apercu; scr->balloon->objectWindow = icon->core->window; if ((scr->balloon->prevType == object->parent_type || scr->balloon->prevType == WCLASS_APPICON) && scr->balloon->ignoreTimer) { XUnmapWindow(dpy, scr->balloon->window); showBalloon(scr); } else { scr->balloon->timer = WMAddTimerHandler(BALLOON_DELAY, (WMCallback *) showBalloon, scr); } }
void DockWnd::callProc(unsigned long param) { unsigned id; Client *client; switch (param){ case WM_RBUTTONUP: QTimer::singleShot(0, this, SLOT(showPopup())); return; case WM_LBUTTONDBLCLK: bNoToggle = true; QTimer::singleShot(0, this, SLOT(dbl_click())); return; case WM_LBUTTONDOWN: if (!bNoToggle) QTimer::singleShot(500, this, SLOT(toggle())); return; case NIN_BALLOONHIDE: case NIN_BALLOONTIMEOUT: case NIN_BALLOONUSERCLICK: if (m_queue.empty()) return; id = m_queue.front().id; client = m_queue.front().client; m_queue.erase(m_queue.begin()); if (!m_queue.empty()) showBalloon(); if (param == NIN_BALLOONUSERCLICK){ Command cmd; cmd->id = id; cmd->param = client; Event e(EventCommandExec, cmd); e.process(); } return; } }
void *DockWnd::processEvent(Event *e) { switch (e->type()){ case EventMessageReceived: case EventMessageRead: case EventMessageDeleted: reset(); break; case EventSetMainIcon: m_state = (const char*)(e->param()); if (!bBlink) setIcon(m_state); break; case EventSetMainText: m_tip = (const char*)(e->param()); setTip(m_tip); break; case EventIconChanged: setIcon((bBlink && m_unread) ? m_unread : m_state); break; case EventLanguageChanged: setTip(m_tip); break; case EventQuit: quit(); break; #ifdef WIN32 case EventShowError:{ if (!m_bBalloon) return NULL; clientErrorData *data = (clientErrorData*)(e->param()); if (data->id == 0) return NULL; for (list<BalloonItem>::iterator it = m_queue.begin(); it != m_queue.end(); ++it){ if ((*it).id == data->id) return e->param(); } QString arg; if (data->args){ arg = QString::fromUtf8(data->args); free(data->args); } BalloonItem item; item.id = data->id; item.client = data->client; item.flags = (data->flags & ERR_INFO) ? NIIF_INFO : NIIF_ERROR; item.text = i18n(data->err_str); if (item.text.find("%1") >= 0) item.text = item.text.arg(arg); if (!m_queue.empty()){ m_queue.push_back(item); return e->param(); } item.title = "SIM"; if (getContacts()->nClients() > 1){ for (unsigned i = 0; i < getContacts()->nClients(); i++){ if (getContacts()->getClient(i) == data->client){ item.title = getContacts()->getClient(i)->name().c_str(); int n = item.title.find("."); if (n > 0) item.title = item.title.left(n) + " " + item.title.mid(n + 1); } } } m_queue.push_back(item); if (showBalloon()) return e->param(); return NULL; } #endif } return NULL; }
static void appiconBalloon(WObjDescriptor *object) { WAppIcon *aicon = (WAppIcon *) object->parent; WScreen *scr = aicon->icon->core->screen_ptr; char *tmp; /* Show balloon if it is the Clip and the workspace name is > 5 chars */ if (object->parent == w_global.clip.icon) { if (strlen(w_global.workspace.array[w_global.workspace.current]->name) > 5) { scr->balloon->text = wstrdup(w_global.workspace.array[w_global.workspace.current]->name); } else { wBalloonHide(scr); return; } } else if (aicon->command && aicon->wm_class) { int len; WApplication *app; unsigned int app_win_cnt = 0; if (object->parent_type == WCLASS_DOCK_ICON) { if (aicon->main_window) { app = wApplicationOf(aicon->main_window); if (app && app->main_window_desc && app->main_window_desc->fake_group) app_win_cnt = app->main_window_desc->fake_group->retainCount - 1; } } /* Check to see if it is a GNUstep app */ if (strcmp(aicon->wm_class, "GNUstep") == 0) len = strlen(aicon->command) + strlen(aicon->wm_instance) + 8; else len = strlen(aicon->command) + strlen(aicon->wm_class) + 8; if (app_win_cnt > 0) len += 1 + snprintf(NULL, 0, "%u", app_win_cnt); tmp = wmalloc(len); /* Check to see if it is a GNUstep App */ if (strcmp(aicon->wm_class, "GNUstep") == 0) if (app_win_cnt > 0) snprintf(tmp, len, "%u %s\n(%s)", app_win_cnt, aicon->wm_instance, aicon->command); else snprintf(tmp, len, "%s\n(%s)", aicon->wm_instance, aicon->command); else if (app_win_cnt > 0) snprintf(tmp, len, "%u %s\n(%s)", app_win_cnt, aicon->wm_class, aicon->command); else snprintf(tmp, len, "%s\n(%s)", aicon->wm_class, aicon->command); scr->balloon->text = tmp; } else if (aicon->command) { scr->balloon->text = wstrdup(aicon->command); } else if (aicon->wm_class) { /* Check to see if it is a GNUstep App */ if (strcmp(aicon->wm_class, "GNUstep") == 0) scr->balloon->text = wstrdup(aicon->wm_instance); else scr->balloon->text = wstrdup(aicon->wm_class); } else { wBalloonHide(scr); return; } scr->balloon->h = aicon->icon->core->height - 2; scr->balloon->objectWindow = aicon->icon->core->window; if ((scr->balloon->prevType == object->parent_type || scr->balloon->prevType == WCLASS_MINIWINDOW) && scr->balloon->ignoreTimer) { XUnmapWindow(dpy, scr->balloon->window); showBalloon(scr); } else { scr->balloon->timer = WMAddTimerHandler(BALLOON_DELAY, (WMCallback *) showBalloon, scr); } }