already_AddRefed<nsIPerformanceStats> nsPerformanceSnapshot::ImportStats(JSContext* cx, const js::PerformanceData& performance, const uint64_t uid) { JS::RootedObject global(cx, JS::CurrentGlobalOrNull(cx)); if (!global) { // While it is possible for a compartment to have no global // (e.g. atoms), this compartment is not very interesting for us. return nullptr; } nsString groupId; GetGroupId(cx, uid, groupId); nsString addonId; GetAddonId(cx, global, addonId); nsString title; uint64_t windowId; GetWindowData(cx, title, &windowId); nsAutoString name; nsAutoCString cname; xpc::GetCurrentCompartmentName(cx, cname); name.Assign(NS_ConvertUTF8toUTF16(cname)); bool isSystem = GetIsSystem(cx, global); nsCOMPtr<nsIPerformanceStats> result = new nsPerformanceStats(name, groupId, addonId, title, windowId, isSystem, performance); return result.forget(); }
already_AddRefed<nsIPerformanceStats> nsPerformanceSnapshot::ImportStats(JSContext* cx, const js::PerformanceData& performance, const uint64_t uid, nsIPerformanceStats* parent) { if (performance.ticks == 0) { // Ignore compartments with no activity. return nullptr; } JS::RootedObject global(cx, JS::CurrentGlobalOrNull(cx)); if (!global) { // While it is possible for a compartment to have no global // (e.g. atoms), this compartment is not very interesting for us. return nullptr; } nsString groupId; GetGroupId(cx, uid, groupId); nsString addonId; GetAddonId(cx, global, addonId); nsString title; uint64_t windowId; GetWindowData(cx, title, &windowId); nsString name; GetName(cx, global, name); bool isSystem = GetIsSystem(cx, global); nsCOMPtr<nsIPerformanceStats> result = new nsPerformanceStats(name, parent, groupId, addonId, title, windowId, mProcessId, isSystem, performance); return result.forget(); }
extern void CheckScreens( NETFILE *fp, Bool fInit) { char sname[SIZE_NAME]; PacketClass klass; ENTER_FUNC; while ((klass = GL_RecvPacketClass(fp)) == GL_QueryScreen) { GL_RecvString(fp, sizeof(sname), sname); GL_RecvInt(fp); /*stsize*/ GL_RecvInt(fp); /*stctime*/ GL_RecvInt(fp); /*stmtime*/ if (GetWindowData(sname) == NULL) { GL_SendPacketClass(fp,GL_GetScreen); RecvFile(fp, sname); } else { GL_SendPacketClass(fp, GL_NOT); } if (fInit) { ShowWindow(sname); fInit = FALSE; } } LEAVE_FUNC; }
WndData::WndData ( OBJECTID oiWnd ) { m_oiWnd = oiWnd; m_fDirty = FALSE; m_nChanged = 0; GetWindowData(); }
extern void UpdateWindow(char *windowName) { WindowData *wdata; WidgetData *data; wdata = GetWindowData(windowName); g_return_if_fail(wdata != NULL); while( (data = (WidgetData *)DeQueueNoWait(wdata->UpdateWidgetQueue)) != NULL ) { UpdateWidget(data); } }
static LRESULT CALLBACK MainWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { PMIXER_WINDOW MixerWindow; DWORD CtrlID, LineOffset; LRESULT Result = 0; SET_VOLUME_CONTEXT Context; switch (uMsg) { case WM_COMMAND: { MixerWindow = GetWindowData(hwnd, MIXER_WINDOW); switch (LOWORD(wParam)) { case IDC_PROPERTIES: { PREFERENCES_CONTEXT Pref; Pref.MixerWindow = MixerWindow; Pref.Mixer = NULL; Pref.SelectedLine = Preferences.SelectedLine; if (DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_PREFERENCES), hwnd, DlgPreferencesProc, (LPARAM)&Pref) == IDOK) { /* update window */ TCHAR szProduct[MAXPNAMELEN]; /* get mixer product name */ if (SndMixerGetProductName(MixerWindow->Mixer, szProduct, sizeof(szProduct) / sizeof(szProduct[0])) == -1) { /* failed to get name */ szProduct[0] = L'\0'; } else { /* copy product */ wcscpy(Preferences.DeviceName, szProduct); } /* destroy old status bar */ DestroyWindow(MixerWindow->hStatusBar); /* update details */ Preferences.SelectedLine = Pref.SelectedLine; /* destroy old mixer */ SndMixerDestroy(Preferences.MixerWindow->Mixer); /* use new selected mixer */ Preferences.MixerWindow->Mixer = Pref.Mixer; /* rebuild dialog controls */ RebuildMixerWindowControls(&Preferences); /* create status window */ MixerWindow->hStatusBar = CreateStatusWindow(WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS, NULL, hwnd, 0); /* set status bar */ if (MixerWindow->hStatusBar) { SendMessage(MixerWindow->hStatusBar, WM_SETTEXT, 0, (LPARAM)szProduct); } } break; } case IDC_EXIT: { PostQuitMessage(0); break; } case IDC_ABOUT: { HICON hAppIcon = (HICON)GetClassLongPtrW(hwnd, GCLP_HICON); ShellAbout(hwnd, lpAppTitle, NULL, hAppIcon); break; } default: { /* get button id */ CtrlID = LOWORD(wParam); /* check if the message is from the line switch */ if (HIWORD(wParam) == BN_CLICKED && (CtrlID % IDC_LINE_SWITCH == 0)) { /* compute line offset */ LineOffset = CtrlID / IDC_LINE_SWITCH; /* compute window id of line name static control */ CtrlID = LineOffset * IDC_LINE_NAME; /* get line name */ if (GetDlgItemTextW(hwnd, CtrlID, Context.LineName, MIXER_LONG_NAME_CHARS) != 0) { /* setup context */ Context.SliderPos = SendMessage((HWND)lParam, BM_GETCHECK, 0, 0); Context.bVertical = FALSE; Context.bSwitch = TRUE; /* set volume */ SndMixerEnumConnections(Preferences.MixerWindow->Mixer, Preferences.SelectedLine, SetVolumeCallback, (LPVOID)&Context); } } } } break; } case MM_MIXM_LINE_CHANGE: { DPRINT("MM_MIXM_LINE_CHANGE\n"); break; } case MM_MIXM_CONTROL_CHANGE: { DPRINT("MM_MIXM_CONTROL_CHANGE\n"); /* get mixer window */ MixerWindow = GetWindowData(hwnd, MIXER_WINDOW); /* sanity checks */ assert(MixerWindow); assert(MixerWindow->Mixer->hmx == (HMIXER)wParam); SndMixerEnumConnections(MixerWindow->Mixer, Preferences.SelectedLine, MixerControlChangeCallback, (PVOID)lParam); break; } case WM_VSCROLL: { if (LOWORD(wParam) == TB_THUMBTRACK) { /* get dialog item ctrl */ CtrlID = GetDlgCtrlID((HWND)lParam); /* get line index */ LineOffset = CtrlID / IDC_LINE_SLIDER_VERT; /* compute window id of line name static control */ CtrlID = LineOffset * IDC_LINE_NAME; /* get line name */ if (GetDlgItemTextW(hwnd, CtrlID, Context.LineName, MIXER_LONG_NAME_CHARS) != 0) { /* setup context */ Context.SliderPos = HIWORD(wParam); Context.bVertical = TRUE; Context.bSwitch = FALSE; /* set volume */ SndMixerEnumConnections(Preferences.MixerWindow->Mixer, Preferences.SelectedLine, SetVolumeCallback, (LPVOID)&Context); } } break; } case WM_CREATE: { MixerWindow = ((LPCREATESTRUCT)lParam)->lpCreateParams; SetWindowLongPtr(hwnd, GWL_USERDATA, (LONG_PTR)MixerWindow); MixerWindow->hWnd = hwnd; MixerWindow->Mixer = SndMixerCreate(MixerWindow->hWnd); if (MixerWindow->Mixer != NULL) { TCHAR szProduct[MAXPNAMELEN]; /* get mixer product name */ if (SndMixerGetProductName(MixerWindow->Mixer, szProduct, sizeof(szProduct) / sizeof(szProduct[0])) == -1) { /* failed to get name */ szProduct[0] = L'\0'; } /* initialize perferences */ ZeroMemory(&Preferences, sizeof(Preferences)); /* store mixer */ Preferences.Mixer = MixerWindow->Mixer; /* store mixer window */ Preferences.MixerWindow = MixerWindow; /* first destination line id */ Preferences.SelectedLine = 0xFFFF0000; /* copy product */ wcscpy(Preferences.DeviceName, szProduct); if (!RebuildMixerWindowControls(&Preferences)) { DPRINT("Rebuilding mixer window controls failed!\n"); SndMixerDestroy(MixerWindow->Mixer); MixerWindow->Mixer = NULL; Result = -1; } /* create status window */ MixerWindow->hStatusBar = CreateStatusWindow(WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS, NULL, hwnd, 0); if (MixerWindow->hStatusBar) { SendMessage(MixerWindow->hStatusBar, WM_SETTEXT, 0, (LPARAM)szProduct); } } break; } case WM_DESTROY: { MixerWindow = GetWindowData(hwnd, MIXER_WINDOW); if (MixerWindow != NULL) { if (MixerWindow->Mixer != NULL) { SndMixerDestroy(MixerWindow->Mixer); } HeapFree(hAppHeap, 0, MixerWindow); } break; } case WM_CLOSE: { PostQuitMessage(0); break; } default: { Result = DefWindowProc(hwnd, uMsg, wParam, lParam); break; } } return Result; }
extern WidgetType GetWidgetType( char *wname, char *name) { WindowData *wdata; GtkWidget *widget; long type; wdata = GetWindowData(wname); if (wdata != NULL && wdata->xml != NULL) { widget = glade_xml_get_widget_by_long_name( (GladeXML *)wdata->xml, name); } else { MessageLogPrintf("window data [%s] is not found", wname); return WIDGET_TYPE_UNKNOWN; } if (widget != NULL) { type = (long)(G_OBJECT_TYPE(widget)); if (type == GTK_TYPE_NUMBER_ENTRY) { return WIDGET_TYPE_NUMBER_ENTRY; } else if (type == GTK_PANDA_TYPE_COMBO) { return WIDGET_TYPE_PANDA_COMBO; } else if (type == GTK_PANDA_TYPE_CLIST) { return WIDGET_TYPE_PANDA_CLIST; } else if (type == GTK_PANDA_TYPE_ENTRY) { return WIDGET_TYPE_PANDA_ENTRY; } else if (type == GTK_PANDA_TYPE_TEXT) { return WIDGET_TYPE_PANDA_TEXT; } else if (type == GTK_PANDA_TYPE_PDF) { return WIDGET_TYPE_PANDA_PREVIEW; } else if (type == GTK_PANDA_TYPE_TIMER) { return WIDGET_TYPE_PANDA_TIMER; } else if (type == GTK_PANDA_TYPE_DOWNLOAD) { return WIDGET_TYPE_PANDA_DOWNLOAD; } else if (type == GTK_PANDA_TYPE_DOWNLOAD2) { return WIDGET_TYPE_PANDA_DOWNLOAD2; } else if (type == GTK_PANDA_TYPE_PRINT) { return WIDGET_TYPE_PANDA_PRINT; } else if (type == GTK_PANDA_TYPE_HTML) { return WIDGET_TYPE_PANDA_HTML; } else if (type == GTK_PANDA_TYPE_TABLE) { return WIDGET_TYPE_PANDA_TABLE; } else if (type == GTK_TYPE_WINDOW) { return WIDGET_TYPE_WINDOW; } else if (type == GTK_TYPE_ENTRY) { return WIDGET_TYPE_ENTRY; } else if (type == GTK_PANDA_TYPE_TEXT) { return WIDGET_TYPE_TEXT; } else if (type == GTK_TYPE_LABEL) { return WIDGET_TYPE_LABEL; } else if (type == GTK_TYPE_BUTTON) { return WIDGET_TYPE_BUTTON; } else if (type == GTK_TYPE_TOGGLE_BUTTON) { return WIDGET_TYPE_TOGGLE_BUTTON; } else if (type == GTK_TYPE_CHECK_BUTTON) { return WIDGET_TYPE_CHECK_BUTTON; } else if (type == GTK_TYPE_RADIO_BUTTON) { return WIDGET_TYPE_RADIO_BUTTON; } else if (type == GTK_TYPE_CALENDAR) { return WIDGET_TYPE_CALENDAR; } else if (type == GTK_TYPE_NOTEBOOK) { return WIDGET_TYPE_NOTEBOOK; } else if (type == GTK_TYPE_PROGRESS_BAR) { return WIDGET_TYPE_PROGRESS_BAR; } else if (type == GTK_TYPE_FRAME) { return WIDGET_TYPE_FRAME; } else if (type == GTK_TYPE_SCROLLED_WINDOW) { return WIDGET_TYPE_SCROLLED_WINDOW; } else if (type == GTK_TYPE_FILE_CHOOSER_BUTTON) { return WIDGET_TYPE_FILE_CHOOSER_BUTTON; } else if (type == GTK_TYPE_COLOR_BUTTON) { return WIDGET_TYPE_COLOR_BUTTON; } else if (type == GTK_PANDA_TYPE_PIXMAP) { return WIDGET_TYPE_PIXMAP; } else if (type == GTK_PANDA_TYPE_FILE_ENTRY) { return WIDGET_TYPE_FILE_ENTRY; } } return WIDGET_TYPE_UNKNOWN; }