BOOL ParseWindowCommand(DesktopWindow* dw, const OpString& cmd) { #if defined(DEBUG_IPC_PARSING) OpString8 tmp; tmp.Set(cmd); printf("window target: %p, cmd: %s\n", dw, tmp.CStr()); #endif if (!dw) { return FALSE; } if (cmd.Compare("raise()") == 0) { int p1 = cmd.FindFirstOf('('); int p2 = cmd.FindLastOf(')'); if (p1 >= 0 && p1 < p2) { RaiseWindow(dw); } } else if (cmd.Compare("lower()") == 0 ) { int p1 = cmd.FindFirstOf('('); int p2 = cmd.FindLastOf(')'); if (p1 >= 0 && p1 < p2) { LowerWindow(dw); } } return TRUE; }
/*********************************************************************** * * Procedure: * HandleVisibilityNotify - record fully visible windows for * use in the RaiseLower function and the OnTop type windows. * ************************************************************************/ void HandleVisibilityNotify() { XVisibilityEvent *vevent = (XVisibilityEvent *) &Event; DBUG("HandleVisibilityNotify","Routine Entered"); if(Tmp_win && Tmp_win->frame == last_event_window) { if(vevent->state == VisibilityUnobscured) Tmp_win->flags |= VISIBLE; else Tmp_win->flags &= ~VISIBLE; /* For the most part, we'll raised partially obscured ONTOP windows * here. The exception is ONTOP windows that are obscured by * other ONTOP windows, which are raised in KeepOnTop(). This * complicated set-up saves us from continually re-raising * every on top window */ if(((vevent->state == VisibilityPartiallyObscured)|| (vevent->state == VisibilityFullyObscured))&& (Tmp_win->flags&ONTOP)&&(Tmp_win->flags & RAISED)) { RaiseWindow(Tmp_win); Tmp_win->flags &= ~RAISED; } } }
void create_points_frame(void *data) { set_wait_cursor(); if (points_frame == NULL) { Widget dialog, wbut, rc, fr; points_frame = CreateDialogForm(app_shell, "Point explorer"); fr = CreateFrame(points_frame, NULL); AddDialogFormChild(points_frame, fr); locate_point_message = CreateLabel(fr, "Point explorer"); dialog = CreateVContainer(points_frame); AddDialogFormChild(points_frame, dialog); track_set_sel = CreateSetChoice(dialog, "Restrict to set:", LIST_TYPE_SINGLE, TRUE); AddListChoiceCB(track_set_sel, track_set_cbproc, NULL); rc = CreateHContainer(dialog); goto_index_item = CreateTextItem(rc, 6, "Point location:"); wbut = CreateButton(rc, "Goto point"); AddButtonCB(wbut, do_gotopt_proc, NULL); locate_point_item = CreateTextInput(dialog, "Point data:"); CreateSeparator(dialog); rc = CreateHContainer(dialog); wbut = CreateButton(rc, "Track"); AddButtonCB(wbut, do_track_proc, NULL); wbut = CreateButton(rc, "Move"); AddButtonCB(wbut, do_ptsmove_proc, (void *) MOVE_POINT_XY); wbut = CreateButton(rc, "Move X"); AddButtonCB(wbut, do_ptsmove_proc, (void *) MOVE_POINT_X); wbut = CreateButton(rc, "Move Y"); AddButtonCB(wbut, do_ptsmove_proc, (void *) MOVE_POINT_Y); wbut = CreateButton(rc, "Prepend"); AddButtonCB(wbut, do_add_proc, (void *) ADD_POINT_BEGINNING); wbut = CreateButton(rc, "Append"); AddButtonCB(wbut, do_add_proc, (void *) ADD_POINT_END); wbut = CreateButton(rc, "Insert"); AddButtonCB(wbut, do_add_proc, (void *) ADD_POINT_NEAREST); wbut = CreateButton(rc, "Delete"); AddButtonCB(wbut, do_del_proc, NULL); wbut = CreateButton(rc, "Close"); AddButtonCB(wbut, points_done_proc, (void *) points_frame); ManageChild(points_frame); } RaiseWindow(GetParent(points_frame)); unset_wait_cursor(); }
/* * create file selection pop up to choose the file for hotlink */ static void create_hotfiles_popup(Widget but, void *data) { static FSBStructure *fsb = NULL; set_wait_cursor(); if (fsb == NULL) { fsb = CreateFileSelectionBox(app_shell, "Hotlinked file"); AddFileSelectionBoxCB(fsb, do_hotlinkfile_proc, data); ManageChild(fsb->FSB); } RaiseWindow(fsb->dialog); unset_wait_cursor(); }
void create_datasetprop_popup(Widget but, void *data) { set_wait_cursor(); if (tui.top == NULL) { Widget menubar, menupane, fr; int i, j; char *rowlabels[MAX_SET_COLS]; char *collabels[DATA_STAT_COLS] = {"Min", "at", "Max", "at", "Mean", "Stdev"}; int column_widths[DATA_STAT_COLS] = {12, 6, 12, 6, 12, 12}; GraceApp *gapp = (GraceApp *) data; tui.top = CreateDialogForm(app_shell, "Data set statistics"); menubar = CreateMenuBar(tui.top); ManageChild(menubar); AddDialogFormChild(tui.top, menubar); tui.sel = CreateGraphSetSelector(tui.top, "Data sets:", LIST_TYPE_SINGLE); AddDialogFormChild(tui.top, tui.sel->frame); AddStorageChoiceCB(tui.sel->set_sel, changetypeCB, tui.sel); menupane = CreateMenu(menubar, "File", 'F', FALSE); CreateMenuCloseButton(menupane, tui.top); menupane = CreateMenu(menubar, "Help", 'H', TRUE); CreateMenuHelpButton(menupane, "On data sets", 's', tui.top, "doc/UsersGuide.html#data-sets"); for (i = 0; i < MAX_SET_COLS; i++) { rowlabels[i] = copy_string(NULL, dataset_col_name(gapp->grace, i)); for (j = 0; j < DATA_STAT_COLS; j++) { tui.rows[i][j] = NULL; } } fr = CreateFrame(tui.top, "Statistics"); tui.mw = CreateTable("mw", fr, MAX_SET_COLS, DATA_STAT_COLS, MAX_SET_COLS, 4); TableDataSetPropInit(tui.mw); TableSetColLabels(tui.mw, collabels); TableSetColWidths(tui.mw, column_widths); TableSetDefaultColAlignment(tui.mw, ALIGN_END); TableSetDefaultColLabelAlignment(tui.mw, ALIGN_CENTER); TableSetRowLabels(tui.mw, rowlabels); TableSetDefaultRowLabelWidth(tui.mw, 3); TableSetDefaultRowLabelAlignment(tui.mw, ALIGN_CENTER); TableUpdateVisibleRowsCols(tui.mw); AddTableEnterCellCB(tui.mw, enterCB, NULL); AddDialogFormChild(tui.top, fr); ManageChild(tui.top); } RaiseWindow(GetParent(tui.top)); unset_wait_cursor(); }
void create_leval_frame(Widget but, void *data) { Quark *gr = (Quark *) data; if (!gr) { return; } set_wait_cursor(); levalui.gr = gr; if (levalui.top == NULL) { int i; Widget fr, rc1; int nscols; char *rows[MAX_SET_COLS][1]; char **cells[MAX_SET_COLS]; char *rowlabels[MAX_SET_COLS]; int column_widths[1] = {50}; int column_maxlengths[1] = {256}; Grace *grace = grace_from_quark(gr); levalui.top = CreateDialogForm(app_shell, "Load & evaluate"); fr = CreateFrame(levalui.top, "Parameter mesh ($t)"); AddDialogFormChild(levalui.top, fr); rc1 = CreateHContainer(fr); levalui.start = CreateTextItem(rc1, 10, "Start at:"); levalui.stop = CreateTextItem(rc1, 10, "Stop at:"); levalui.npts = CreateTextItem(rc1, 6, "Length:"); levalui.set_type = CreateSetTypeChoice(levalui.top, "Set type:"); AddDialogFormChild(levalui.top, levalui.set_type->menu); AddOptionChoiceCB(levalui.set_type, set_type_cb, (void *) &levalui); nscols = 2; for (i = 0; i < nscols; i++) { rowlabels[i] = copy_string(NULL, dataset_col_name(grace, i)); rowlabels[i] = concat_strings(rowlabels[i], " = "); if (i == 0) { rows[i][0] = "$t"; } else { rows[i][0] = ""; } cells[i] = &rows[i][0]; } levalui.mw = CreateTable("mw", levalui.top, nscols, 1, MAX_SET_COLS, 1); TableLevalInit(levalui.mw); TableSetColWidths(levalui.mw, column_widths); TableSetColMaxlengths(levalui.mw, column_maxlengths); TableSetRowLabels(levalui.mw, rowlabels); TableSetDefaultRowLabelWidth(levalui.mw, 6); TableSetDefaultRowLabelAlignment(levalui.mw, ALIGN_CENTER); TableSetCells(levalui.mw, cells); TableUpdateVisibleRowsCols(levalui.mw); AddTableLeaveCellCB(levalui.mw, leaveCB, &levalui); CreateAACDialog(levalui.top, levalui.mw, leval_aac_cb, &levalui); } RaiseWindow(GetParent(levalui.top)); unset_wait_cursor(); }
void create_datasetop_popup(Widget but, void *data) { Widget dialog, menubar, menupane, rc; set_wait_cursor(); if (datasetopui.top == NULL) { datasetopui.top = CreateDialogForm(app_shell, "Data set operations"); SetDialogFormResizable(datasetopui.top, TRUE); menubar = CreateMenuBar(datasetopui.top); ManageChild(menubar); AddDialogFormChild(datasetopui.top, menubar); dialog = CreateVContainer(datasetopui.top); #ifdef MOTIF_GUI XtVaSetValues(dialog, XmNrecomputeSize, True, NULL); #endif datasetopui.sel = CreateSSDChoice(dialog, "Data sets:", LIST_TYPE_MULTIPLE); menupane = CreateMenu(menubar, "File", 'F', FALSE); CreateMenuButton(menupane, "Close", 'C', destroy_dialog_cb, GetParent(datasetopui.top)); menupane = CreateMenu(menubar, "Help", 'H', TRUE); CreateMenuHelpButton(menupane, "On dataset operations", 's', datasetopui.top, "doc/UsersGuide.html#data-set-operations"); datasetopui.optype_item = CreateOptionChoiceVA(dialog, "Operation type:", "Reverse", DATASETOP_REVERSE, "Transpose", DATASETOP_TRANSPOSE, "Coalesce", DATASETOP_COALESCE, #if 0 "Sort", DATASETOP_SORT, "Split", DATASETOP_SPLIT, #endif "Drop rows", DATASETOP_DROP, NULL); AddOptionChoiceCB(datasetopui.optype_item, datasetoptypeCB, NULL); rc = CreateHContainer(dialog); #ifdef MOTIF_GUI XtVaSetValues(rc, XmNrecomputeSize, True, NULL); #endif /* Sort */ datasetopui.up_down_item = CreateOptionChoiceVA(rc, "Order:", "Ascending", FALSE, "Descending", TRUE, NULL); datasettype_controls[0] = rc; /* Reverse */ rc = CreateVContainer(dialog); CreateSeparator(rc); datasettype_controls[1] = rc; /* Transpose */ rc = CreateVContainer(dialog); CreateSeparator(rc); datasettype_controls[2] = rc; /* Coalesce */ rc = CreateVContainer(dialog); CreateSeparator(rc); datasettype_controls[3] = rc; /* Split */ rc = CreateVContainer(dialog); datasetopui.length_item = CreateTextItem(rc, 6, "Length:"); datasettype_controls[4] = rc; /* Drop rows */ rc = CreateHContainer(dialog); datasetopui.start_item = CreateTextItem(rc, 6, "Start at:"); datasetopui.stop_item = CreateTextItem(rc, 6, "Stop at:"); datasettype_controls[5] = rc; UnmanageChild(datasettype_controls[0]); ManageChild(datasettype_controls[1]); UnmanageChild(datasettype_controls[2]); UnmanageChild(datasettype_controls[3]); UnmanageChild(datasettype_controls[4]); UnmanageChild(datasettype_controls[5]); CreateAACDialog(datasetopui.top, dialog, datasetop_aac_cb, &datasetopui); } RaiseWindow(GetParent(datasetopui.top)); unset_wait_cursor(); }
BOOL ParseCommand(BrowserDesktopWindow* bw, const OpString& cmd) { #if defined(DEBUG_IPC_PARSING) OpString8 tmp; tmp.Set(cmd); printf("target: %p, cmd: %s\n", bw, tmp.CStr()); #endif if (!bw) { return FALSE; } ParsedData pd; if (cmd.Find("openURL") == 0) { if (ParseOpenUrlCommand(cmd, pd)) { #if defined(DEBUG_IPC_PARSING) DumpParsedData(pd); #endif if (pd.address.IsEmpty()) { RaiseWindow(bw); g_input_manager->InvokeAction(OpInputAction::ACTION_GO_TO_PAGE); } else { /* Not all combinations of values in pd are * sensible. And only some combinations have * actually been tested. In particular, setting * both new_page and new_window to TRUE may not * work as expected. And the same for setting * in_background to TRUE but new_page to FALSE. */ // Set up the url opening parameters OpenURLSetting url_setting; url_setting.m_address.Set(pd.address); url_setting.m_new_page = MAYBE; url_setting.m_new_window = MAYBE; url_setting.m_in_background = MAYBE; url_setting.m_ignore_modifier_keys = TRUE; url_setting.m_is_privacy_mode = pd.privacy_mode; url_setting.m_is_remote_command = TRUE; if (pd.new_window) { url_setting.m_new_page = NO; url_setting.m_new_window = YES; url_setting.m_in_background = NO; } if (pd.new_tab) url_setting.m_new_page = YES; if (pd.in_background) url_setting.m_in_background = YES; if (!pd.new_window) { url_setting.m_target_window = bw; #if 0 /* This code sets url_setting.m_src_window. * It used to happen as a side effect of * calling g_application->GoToPage(), and I * copied it in here when I rewrote the code * to use the single-parameter OpenURL() * instead. * * It is probably not needed. Most likely it * does more harm than good. I expect * m_src_window indicates which window * initiated the loading. It seems obvious to * me that when loading is initiated by an * external application, no opera window * should be set as opener. * * I chose to ifdef out the code rather than * delete it in order to more easily test if * removing this code is the cause of any * strange regression we might run into. */ BrowserDesktopWindow* browser = g_application->GetActiveBrowserDesktopWindow(); if (browser) { DesktopWindow *active_win = browser->GetActiveDesktopWindow(); if (active_win) { OpWindowCommander *win_com = active_win->GetWindowCommander(); if (win_com) { // This sets setting.m_src_window to win_com's window WindowCommanderProxy::InitOpenURLSetting(url_setting, win_com); } } } #endif } // Ok, URL opening parameters are set up, now do the work if (!pd.noraise && !pd.new_window) RaiseWindow(bw); if (pd.new_window) { // I suspect this block is here just to be able to set the geometry. Application::StartupSetting setting; setting.open_in_background = FALSE; setting.open_in_new_page = FALSE; setting.open_in_new_window = TRUE; setting.fullscreen = FALSE; setting.iconic = FALSE; setting.geometry = pd.window_rect; g_application->SetStartupSetting(setting); } g_application->OpenURL(url_setting); } } } else if (cmd.Find("newInstance") == 0) { if (ParseDestinationCommand(cmd, pd)) { #if defined(DEBUG_IPC_PARSING) DumpParsedData(pd); #endif if (pd.in_background) { if (!pd.noraise) RaiseWindow(bw); g_application->CreateDocumentDesktopWindow(bw->GetWorkspace(), NULL, 0, 0, TRUE, FALSE, TRUE, FALSE, NULL, pd.privacy_mode); } else if (pd.new_tab) { if (!pd.noraise) RaiseWindow(bw); g_application->CreateDocumentDesktopWindow(bw->GetWorkspace(), NULL, 0, 0, TRUE, FALSE, FALSE, FALSE, NULL, pd.privacy_mode); } else if (pd.new_window) { Application::StartupSetting setting; setting.open_in_background = FALSE; setting.open_in_new_page = FALSE; setting.open_in_new_window = TRUE; setting.fullscreen = FALSE; setting.iconic = FALSE; setting.geometry = pd.window_rect; g_application->SetStartupSetting(setting); g_application->GetBrowserDesktopWindow(TRUE,FALSE,TRUE); } else { if (!pd.noraise) RaiseWindow(bw); g_application->CreateDocumentDesktopWindow(bw->GetWorkspace(), NULL, 0, 0, TRUE, FALSE, FALSE, FALSE, NULL, pd.privacy_mode); } } } else if (cmd.Find("openM2") == 0) { if (ParseDestinationCommand(cmd, pd)) { #if defined(DEBUG_IPC_PARSING) DumpParsedData(pd); #endif if (pd.new_window) { g_application->GetBrowserDesktopWindow(TRUE,FALSE,FALSE); } else if (pd.new_tab || pd.in_background) { return TRUE; } else { if (!pd.noraise) RaiseWindow(bw); } g_input_manager->InvokeAction(OpInputAction::ACTION_READ_MAIL); } } else if (cmd.Find("openComposer") == 0) { if (ParseDestinationCommand(cmd, pd)) { #if defined(DEBUG_IPC_PARSING) DumpParsedData(pd); #endif if (pd.new_window) { g_application->GetBrowserDesktopWindow(TRUE,FALSE,FALSE); } else if (pd.new_tab || pd.in_background) { return TRUE; } else { if (!pd.noraise) RaiseWindow(bw); } g_input_manager->InvokeAction(OpInputAction::ACTION_COMPOSE_MAIL); } } else if (cmd.Find("openFile") == 0) { if (ParseDestinationCommand(cmd, pd)) { #if defined(DEBUG_IPC_PARSING) DumpParsedData(pd); #endif if (pd.new_window) { g_application->GetBrowserDesktopWindow(TRUE,FALSE,FALSE); } else if (pd.new_tab) { if (!pd.noraise) RaiseWindow(bw); g_application->GetBrowserDesktopWindow(FALSE,FALSE,TRUE); } else if (pd.in_background) { return TRUE; } else { if (!pd.noraise) RaiseWindow(bw); } g_input_manager->InvokeAction(OpInputAction::ACTION_OPEN_DOCUMENT); } } else if (cmd.Find("addBookmark") == 0) { if (ParseOpenUrlCommand(cmd, pd)) { #if defined(DEBUG_IPC_PARSING) DumpParsedData(pd); #endif RaiseWindow(bw); /* HotlistManager::ItemData item_data; INT32 id = -1; BrowserDesktopWindow* bw = g_application->GetActiveBrowserDesktopWindow(); if (bw) { id = bw->GetSelectedHotlistItemId(OpTypedObject::PANEL_TYPE_BOOKMARKS); } item_data.url.Set( address ); item_data.name.Set( item_data.url.CStr() ); g_hotlist_manager->NewBookmark( item_data, id, NULL, TRUE ); */ } } else if (cmd.Find("version") == 0) { X11Globals::ShowOperaVersion(TRUE, TRUE, bw); } else { return ParseWindowCommand(bw,cmd); } return TRUE; }
/************************************************************************** * * Moves pointer to specified window * *************************************************************************/ static void warp_to_fvwm_window( XEvent *eventp, FvwmWindow *t, int warp_x, int x_unit, int warp_y, int y_unit) { int dx,dy; int cx,cy; int x,y; if(t == (FvwmWindow *)0 || (IS_ICONIFIED(t) && t->icon_w == None)) return; if(t->Desk != Scr.CurrentDesk) { goto_desk(t->Desk); } if(IS_ICONIFIED(t)) { cx = t->icon_xl_loc + t->icon_g.width/2; cy = t->icon_g.y + t->icon_p_height + ICON_HEIGHT(t) / 2; } else { cx = t->frame_g.x + t->frame_g.width/2; cy = t->frame_g.y + t->frame_g.height/2; } dx = (cx + Scr.Vx) / Scr.MyDisplayWidth * Scr.MyDisplayWidth; dy = (cy + Scr.Vy) / Scr.MyDisplayHeight * Scr.MyDisplayHeight; MoveViewport(dx,dy,True); if(IS_ICONIFIED(t)) { x = t->icon_xl_loc + t->icon_g.width / 2; y = t->icon_g.y + t->icon_p_height + ICON_HEIGHT(t) / 2; } else { if (x_unit != Scr.MyDisplayWidth && warp_x >= 0) x = t->frame_g.x + warp_x; else if (x_unit != Scr.MyDisplayWidth) x = t->frame_g.x + t->frame_g.width + warp_x; else if (warp_x >= 0) x = t->frame_g.x + (t->frame_g.width - 1) * warp_x / 100; else x = t->frame_g.x + (t->frame_g.width - 1) * (100 + warp_x) / 100; if (y_unit != Scr.MyDisplayHeight && warp_y >= 0) y = t->frame_g.y + warp_y; else if (y_unit != Scr.MyDisplayHeight) y = t->frame_g.y + t->frame_g.height + warp_y; else if (warp_y >= 0) y = t->frame_g.y + (t->frame_g.height - 1) * warp_y / 100; else y = t->frame_g.y + (t->frame_g.height - 1) * (100 + warp_y) / 100; } XWarpPointer(dpy, None, Scr.Root, 0, 0, 0, 0, x, y); SetPointerEventPosition(eventp, x, y); RaiseWindow(t); /* If the window is still not visible, make it visible! */ if (t->frame_g.x + t->frame_g.width < 0 || t->frame_g.y + t->frame_g.height < 0 || t->frame_g.x >= Scr.MyDisplayWidth || t->frame_g.y >= Scr.MyDisplayHeight) { SetupFrame(t, 0, 0, t->frame_g.width, t->frame_g.height, False); XWarpPointer(dpy, None, Scr.Root, 0, 0, 0, 0, 2,2); SetPointerEventPosition(eventp, 2, 2); } }
/* * * Moves pointer to specified window * */ static void warp_to_fvwm_window( const exec_context_t *exc, int warp_x, int x_unit, int warp_y, int y_unit, int do_raise) { int dx,dy; int cx,cy; int x,y; FvwmWindow *t = exc->w.fw; if (t == (FvwmWindow *)0 || (IS_ICONIFIED(t) && FW_W_ICON_TITLE(t) == None)) { return; } if (t->Desk != Scr.CurrentDesk) { goto_desk(t->Desk); } if (IS_ICONIFIED(t)) { rectangle g; Bool rc; rc = get_visible_icon_title_geometry(t, &g); if (rc == False) { get_visible_icon_picture_geometry(t, &g); } cx = g.x + g.width / 2; cy = g.y + g.height / 2; } else { cx = t->g.frame.x + t->g.frame.width/2; cy = t->g.frame.y + t->g.frame.height/2; } dx = (cx + Scr.Vx) / Scr.MyDisplayWidth * Scr.MyDisplayWidth; dy = (cy + Scr.Vy) / Scr.MyDisplayHeight * Scr.MyDisplayHeight; if (dx != Scr.Vx || dy != Scr.Vy) { MoveViewport(dx, dy, True); } if (IS_ICONIFIED(t)) { rectangle g; Bool rc; rc = get_visible_icon_title_geometry(t, &g); if (rc == False) { get_visible_icon_picture_geometry(t, &g); } x = g.x + g.width / 2; y = g.y + g.height / 2; } else { if (x_unit != Scr.MyDisplayWidth && warp_x >= 0) { x = t->g.frame.x + warp_x; } else if (x_unit != Scr.MyDisplayWidth) { x = t->g.frame.x + t->g.frame.width + warp_x; } else if (warp_x >= 0) { x = t->g.frame.x + (t->g.frame.width - 1) * warp_x / 100; } else { x = t->g.frame.x + (t->g.frame.width - 1) * (100 + warp_x) / 100; } if (y_unit != Scr.MyDisplayHeight && warp_y >= 0) { y = t->g.frame.y + warp_y; } else if (y_unit != Scr.MyDisplayHeight) { y = t->g.frame.y + t->g.frame.height + warp_y; } else if (warp_y >= 0) { y = t->g.frame.y + (t->g.frame.height - 1) * warp_y / 100; } else { y = t->g.frame.y + (t->g.frame.height - 1) * (100 + warp_y) / 100; } } FWarpPointerUpdateEvpos( exc->x.elast, dpy, None, Scr.Root, 0, 0, 0, 0, x, y); if (do_raise) { RaiseWindow(t, False); } /* If the window is still not visible, make it visible! */ if (t->g.frame.x + t->g.frame.width < 0 || t->g.frame.y + t->g.frame.height < 0 || t->g.frame.x >= Scr.MyDisplayWidth || t->g.frame.y >= Scr.MyDisplayHeight) { frame_setup_window( t, 0, 0, t->g.frame.width, t->g.frame.height, False); FWarpPointerUpdateEvpos( exc->x.elast, dpy, None, Scr.Root, 0, 0, 0, 0, 2, 2); } return; }
//______________________________________________________________________________ void ArgusWindow::TriggerEventHandler() { while (!IsMapped()) { return; } int iSub; const Int_t nSub = fSubWindows->GetEntriesFast(); Int_t tabLevel = 0; const Int_t nTabs = fTabObjects->GetEntriesFast(); Int_t iTab; Int_t *tabStack = new Int_t[nTabs]; char str[64]; UInt_t year, mon, day, hour, min, sec; const char month[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; const Bool_t iUTC = (fTimeZone == "utc"); fWatchAll.Start(false); if (fController) { fController->Update(); } static Bool_t firstCall = kTRUE; ArgusTab *tab; if (firstCall) { for (iTab = 0; iTab < nTabs; iTab++) { tab = GetTabObjectAt(iTab); if (tab && tab->IsNewWindow()) { OpenNewWindow(iTab); } } firstCall = kFALSE; } static Bool_t screenShot = kFALSE; if (fTabWindow) { #if (ROOT_VERSION_CODE < ROOT_VERSION(5,27,6)) ULong_t currentTime = gROME->Now(); #else ULong64_t currentTime = gROME->Now(); #endif if(currentTime - fScreenShotLastTime > fScreenShotPeriod *1000 || !fScreenShotPeriod) { screenShot = kTRUE; fScreenShotLastTime = currentTime; } } // call event handlers for sub-windows for (iSub = 0; iSub < nSub; iSub++) { if (IsSubWindowRunningAt(iSub)) { static_cast<ArgusWindow*>(fSubWindows->At(iSub))->TriggerEventHandler(); } } if (screenShot && fCurrentTabIndex >= 0) { if (GetTabObjectAt(fCurrentTabIndex)->GetScreenShotNameLength()) { RaiseWindow(); } } SetStatus(0, "", 0); if (!gROME->IsStandAloneARGUS()) { // run# #if defined(R__UNIX) sprintf(str, "%7lld", gROME->GetCurrentRunNumber()); #else sprintf(str, "%7I64d", gROME->GetCurrentRunNumber()); #endif fRunNumber ->SetText(str); // event# #if defined(R__UNIX) sprintf(str, "%7lld", gROME->GetCurrentEventNumber()); #else sprintf(str, "%7I64d", gROME->GetCurrentEventNumber()); #endif fEventNumber->SetText(str); // date and time TTimeStamp timeStamp(gROME->GetActiveDAQ()->GetTimeStamp(), 0); timeStamp.GetDate(iUTC, 0, &year, &mon, &day); timeStamp.GetTime(iUTC, 0, &hour, &min, &sec); sprintf(str, "%4d-%3s-%02d", year, month[mon-1], day); fYearMonDay->SetText(str); sprintf(str, "%02d:%02d:%02d", hour, min, sec); fHourMinSec->SetText(str); } // push parent tab's index to stack until reaching the top-level tab tabStack[tabLevel] = fCurrentTabIndex; while (tabLevel+1<nTabs && (tabStack[tabLevel+1]=fParentIndex[tabStack[tabLevel]]) != -1) { tabLevel++; } // call ArgusEventHandler() thru ancestry to descendant for ( ; tabLevel>=0; tabLevel--) { GetTabObjectAt(tabStack[tabLevel])->ArgusEventHandler(); } delete [] tabStack; // call Layout() method to force updating of size of labels in the infoFrame, including UserInfoFrame ((TGCompositeFrame*)(fUserInfoFrame->GetParent()))->Layout(); // clear requests ClearEventHandlingRequest(); ClearEventHandlingForced(); fWatchAll.Stop(); SetStatus(2, "", 0); if (screenShot) { if (GetTabObjectAt(fCurrentTabIndex)->GetScreenShotNameLength()) { GetTabObjectAt(fCurrentTabIndex)->ScreenShot(); } } if (fTabWindow) { screenShot = kFALSE; } }
void HandlePropertyNotify() { XTextProperty text_prop; Boolean OnThisPage = False; DBUG("HandlePropertyNotify","Routine Entered"); if ((!Tmp_win)|| (XGetGeometry(dpy, Tmp_win->w, &JunkRoot, &JunkX, &JunkY, &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0)) return; /* Make sure at least part of window is on this page before giving it focus... */ if ( (Tmp_win->Desk == Scr.CurrentDesk) && ( ((Tmp_win->frame_x + Tmp_win->frame_width) >= 0 && Tmp_win->frame_x < Scr.MyDisplayWidth) && ((Tmp_win->frame_y + Tmp_win->frame_height) >= 0 && Tmp_win->frame_y < Scr.MyDisplayHeight) ) ) { OnThisPage = True; } switch (Event.xproperty.atom) { case XA_WM_TRANSIENT_FOR: { if(XGetTransientForHint(dpy, Tmp_win->w, &Tmp_win->transientfor)) { Tmp_win->flags |= TRANSIENT; RaiseWindow(Tmp_win); } else { Tmp_win->flags &= ~TRANSIENT; } } break; case XA_WM_NAME: if (!XGetWMName(dpy, Tmp_win->w, &text_prop)) return; free_window_names (Tmp_win, True, False); Tmp_win->name = (char *)text_prop.value; if (Tmp_win->name && strlen(Tmp_win->name) > 200) /* limit to prevent hanging X server */ Tmp_win->name[200] = 0; if (Tmp_win->name == NULL) Tmp_win->name = NoName; BroadcastName(M_WINDOW_NAME,Tmp_win->w,Tmp_win->frame, (unsigned long)Tmp_win,Tmp_win->name); /* fix the name in the title bar */ if(!(Tmp_win->flags & ICONIFIED)) SetTitleBar(Tmp_win,(Scr.Hilite==Tmp_win),True); /* * if the icon name is NoName, set the name of the icon to be * the same as the window */ if (Tmp_win->icon_name == NoName) { Tmp_win->icon_name = Tmp_win->name; BroadcastName(M_ICON_NAME,Tmp_win->w,Tmp_win->frame, (unsigned long)Tmp_win,Tmp_win->icon_name); RedoIconName(Tmp_win); } break; case XA_WM_ICON_NAME: if (!XGetWMIconName (dpy, Tmp_win->w, &text_prop)) return; free_window_names (Tmp_win, False, True); Tmp_win->icon_name = (char *) text_prop.value; if (Tmp_win->icon_name && strlen(Tmp_win->icon_name) > 200) /* limit to prevent hanging X server */ Tmp_win->icon_name[200] = 0; if (Tmp_win->icon_name == NULL) Tmp_win->icon_name = NoName; BroadcastName(M_ICON_NAME,Tmp_win->w,Tmp_win->frame, (unsigned long)Tmp_win,Tmp_win->icon_name); RedoIconName(Tmp_win); break; case XA_WM_HINTS: if (Tmp_win->wmhints) XFree ((char *) Tmp_win->wmhints); Tmp_win->wmhints = XGetWMHints(dpy, Event.xany.window); if(Tmp_win->wmhints == NULL) return; if((Tmp_win->wmhints->flags & IconPixmapHint)|| (Tmp_win->wmhints->flags & IconWindowHint)) if(Tmp_win->icon_bitmap_file == Scr.DefaultIcon) Tmp_win->icon_bitmap_file = (char *)0; if((Tmp_win->wmhints->flags & IconPixmapHint)|| (Tmp_win->wmhints->flags & IconWindowHint)) { if (!(Tmp_win->flags & SUPPRESSICON)) { if (Tmp_win->icon_w) XDestroyWindow(dpy,Tmp_win->icon_w); XDeleteContext(dpy, Tmp_win->icon_w, FvwmContext); if(Tmp_win->flags & ICON_OURS) { if(Tmp_win->icon_pixmap_w != None) { XDestroyWindow(dpy,Tmp_win->icon_pixmap_w); XDeleteContext(dpy, Tmp_win->icon_pixmap_w, FvwmContext); } } else XUnmapWindow(dpy,Tmp_win->icon_pixmap_w); } Tmp_win->icon_w = None; Tmp_win->icon_pixmap_w = None; Tmp_win->iconPixmap = (Window)NULL; if(Tmp_win->flags & ICONIFIED) { Tmp_win->flags &= ~ICONIFIED; Tmp_win->flags &= ~ICON_UNMAPPED; CreateIconWindow(Tmp_win, Tmp_win->icon_x_loc,Tmp_win->icon_y_loc); BroadcastPacket(M_ICONIFY, 7, Tmp_win->w, Tmp_win->frame, (unsigned long)Tmp_win, Tmp_win->icon_x_loc, Tmp_win->icon_y_loc, Tmp_win->icon_w_width, Tmp_win->icon_w_height); BroadcastConfig(M_CONFIGURE_WINDOW, Tmp_win); if (!(Tmp_win->flags & SUPPRESSICON)) { LowerWindow(Tmp_win); AutoPlace(Tmp_win); if(Tmp_win->Desk == Scr.CurrentDesk) { if(Tmp_win->icon_w) XMapWindow(dpy, Tmp_win->icon_w); if(Tmp_win->icon_pixmap_w != None) XMapWindow(dpy, Tmp_win->icon_pixmap_w); } } Tmp_win->flags |= ICONIFIED; DrawIconWindow(Tmp_win); } } break; case XA_WM_NORMAL_HINTS: GetWindowSizeHints (Tmp_win); #if 0 /* ** ckh - not sure why this next stuff was here, but fvwm 1.xx ** didn't do this, and it seems to cause a bug when changing ** fonts in XTerm */ { int new_width, new_height; new_width = Tmp_win->frame_width; new_height = Tmp_win->frame_height; ConstrainSize(Tmp_win, &new_width, &new_height, False, 0, 0); if((new_width != Tmp_win->frame_width)|| (new_height != Tmp_win->frame_height)) SetupFrame(Tmp_win,Tmp_win->frame_x, Tmp_win->frame_y, new_width,new_height,False); } #endif /* 0 */ BroadcastConfig(M_CONFIGURE_WINDOW,Tmp_win); break; default: if(Event.xproperty.atom == _XA_WM_PROTOCOLS) FetchWmProtocols (Tmp_win); else if (Event.xproperty.atom == _XA_WM_COLORMAP_WINDOWS) { FetchWmColormapWindows (Tmp_win); /* frees old data */ ReInstallActiveColormap(); } else if(Event.xproperty.atom == _XA_WM_STATE) { if((Tmp_win != NULL)&&(Tmp_win->flags & ClickToFocus) &&(Tmp_win == Scr.Focus)) { if (OnThisPage) { Scr.Focus = NULL; SetFocus(Tmp_win->w,Tmp_win,0); } } } break; } }
/*********************************************************************** * * Procedure: * HandleButtonPress - ButtonPress event handler * ***********************************************************************/ void HandleButtonPress() { unsigned int modifier; Binding *MouseEntry; Window x; int LocalContext; DBUG("HandleButtonPress","Routine Entered"); /* click to focus stuff goes here */ if((Tmp_win)&&(Tmp_win->flags & ClickToFocus)&&(Tmp_win != Scr.Ungrabbed) && ((Event.xbutton.state& (ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) == 0)) { SetFocus(Tmp_win->w,Tmp_win,1); /* #ifdef CLICKY_MODE_1 */ if (Scr.ClickToFocusRaises || ((Event.xany.window != Tmp_win->w)&& (Event.xbutton.subwindow != Tmp_win->w)&& (Event.xany.window != Tmp_win->Parent)&& (Event.xbutton.subwindow != Tmp_win->Parent))) /* #endif */ { RaiseWindow(Tmp_win); } KeepOnTop(); /* Why is this here? Seems to cause breakage with * non-focusing windows! */ if(!(Tmp_win->flags & ICONIFIED)) { XSync(dpy,0); /* pass click event to just clicked to focus window? */ if (Scr.ClickToFocusPassesClick) XAllowEvents(dpy,ReplayPointer,CurrentTime); else /* don't pass click to just focused window */ XAllowEvents(dpy,AsyncPointer,CurrentTime); XSync(dpy,0); return; } } else if ((Tmp_win) && !(Tmp_win->flags & ClickToFocus) && (Event.xbutton.window == Tmp_win->frame) && Scr.MouseFocusClickRaises) { if (Tmp_win != Scr.LastWindowRaised && (Event.xbutton.state & (ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) == 0 && GetContext(Tmp_win,&Event, &PressedW) == C_WINDOW) { RaiseWindow(Tmp_win); KeepOnTop(); } XSync(dpy,0); XAllowEvents(dpy,ReplayPointer,CurrentTime); XSync(dpy,0); return; } XSync(dpy,0); XAllowEvents(dpy,ReplayPointer,CurrentTime); XSync(dpy,0); Context = GetContext(Tmp_win,&Event, &PressedW); LocalContext = Context; x= PressedW; if(Context == C_TITLE) SetTitleBar(Tmp_win,(Scr.Hilite == Tmp_win),False); else SetBorder(Tmp_win,(Scr.Hilite == Tmp_win),True,True,PressedW); ButtonWindow = Tmp_win; /* we have to execute a function or pop up a menu */ modifier = (Event.xbutton.state & mods_used); /* need to search for an appropriate mouse binding */ for (MouseEntry = Scr.AllBindings; MouseEntry != NULL; MouseEntry= MouseEntry->NextBinding) { if(((MouseEntry->Button_Key == Event.xbutton.button)|| (MouseEntry->Button_Key == 0))&& (MouseEntry->Context & Context)&& ((MouseEntry->Modifier == AnyModifier)|| (MouseEntry->Modifier == (modifier& (~LockMask))))&& (MouseEntry->IsMouse == 1)) { /* got a match, now process it */ ExecuteFunction(MouseEntry->Action,Tmp_win, &Event,Context,-1); break; } } PressedW = None; if(LocalContext!=C_TITLE) SetBorder(ButtonWindow,(Scr.Hilite == ButtonWindow),True,True,x); else SetTitleBar(ButtonWindow,(Scr.Hilite==ButtonWindow),False); ButtonWindow = NULL; }