/* if_draw: Draws the interface on the screen. * -------- */ void if_draw(void) { /* Only redisplay the filedlg if it is up */ if (focus == FILE_DLG) { filedlg_display(fd); return; } update_status_win(); if (get_src_height() != 0 && get_gdb_height() != 0) wrefresh(status_win); if (tty_win_on) wrefresh(tty_status_win); if (get_src_height() > 0) source_display(src_win, focus == CGDB); if (tty_win_on && get_tty_height() > 0) scr_refresh(tty_win, focus == TTY); if (get_gdb_height() > 0) scr_refresh(gdb_win, focus == GDB); /* This check is here so that the cursor goes to the * cgdb window. The cursor would stay in the gdb window * on cygwin */ if (get_src_height() > 0 && focus == CGDB) wrefresh(src_win->win); }
unsigned char sb_handle_motion_notify(event_t *ev) { D_EVENTS(("sb_handle_motion_notify(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window)); REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &scrollbar_event_data), 0); if ((PrivateModes & PrivMode_mouse_report) && !(button_state.bypass_keystate)) return 1; D_EVENTS(("MotionNotify event for window 0x%08x\n", ev->xany.window)); D_EVENTS((" up [0x%08x], down [0x%08x], anchor [0x%08x], trough [0x%08x]\n", scrollbar.up_win, scrollbar.dn_win, scrollbar.sa_win, scrollbar.win)); if ((scrollbar_win_is_trough(ev->xany.window) || scrollbar_win_is_anchor(ev->xany.window)) && scrollbar_is_moving()) { Window unused_root, unused_child; int unused_root_x, unused_root_y; unsigned int unused_mask; while (XCheckTypedWindowEvent(Xdisplay, scrollbar.win, MotionNotify, ev)); XQueryPointer(Xdisplay, scrollbar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); scr_move_to(scrollbar_position(ev->xbutton.y) - button_state.mouse_offset, scrollbar_scrollarea_height()); refresh_count = refresh_limit = 0; scr_refresh(refresh_type); scrollbar_anchor_update_position(button_state.mouse_offset); } return 1; }
/* if_draw: Draws the interface on the screen. * -------- */ void if_draw(void) { if (!curses_initialized) return; /* Only redisplay the filedlg if it is up */ if (focus == FILE_DLG) { filedlg_display(fd); return; } update_status_win(WIN_NO_REFRESH); if (get_src_height() != 0 && get_gdb_height() != 0) swin_wnoutrefresh(status_win); if (get_src_height() > 0) source_display(src_viewer, focus == CGDB, WIN_NO_REFRESH); separator_display(cur_split_orientation == WSO_VERTICAL); if (get_gdb_height() > 0) scr_refresh(gdb_scroller, focus == GDB, WIN_NO_REFRESH); /* This check is here so that the cursor goes to the * cgdb window. The cursor would stay in the gdb window * on cygwin */ if (get_src_height() > 0 && focus == CGDB) swin_wnoutrefresh(src_viewer->win); swin_doupdate(); }
void if_print(const char *buf) { /* Print it to the scroller */ scr_add(gdb_win, buf); if (get_gdb_height() > 0) { scr_refresh(gdb_win, focus == GDB); /* Make sure cursor reappears in source window if focus is there */ if (focus == CGDB) wrefresh(src_win->win); } }
void if_tty_print(const char *buf) { /* If the tty I/O window is not open send output to gdb window */ if (!tty_win_on) if_print(buf); /* Print it to the scroller */ scr_add(tty_win, buf); /* Only need to redraw if tty_win is being displayed */ if (tty_win_on && get_gdb_height() > 0) { scr_refresh(tty_win, focus == TTY); /* Make sure cursor reappears in source window if focus is there */ if (focus == CGDB) wrefresh(src_win->win); } }
static void if_print_internal(const char *buf, enum ScrInputKind kind) { if (!gdb_scroller) { clog_error(CLOG_CGDB, "%s", buf); return; } /* Print it to the scroller */ scr_add(gdb_scroller, buf, kind); if (get_gdb_height() > 0) { scr_refresh(gdb_scroller, focus == GDB, WIN_NO_REFRESH); /* Make sure cursor reappears in source window if focus is there */ if (focus == CGDB) swin_wnoutrefresh(src_viewer->win); swin_doupdate(); } }
/* get to handle. Matthias */ int handle_X_event(XEvent event, unsigned char qt_c) { /* no longer needed. Matthias */ /* XEvent event; */ unsigned char *s; int count; Window root, child; int root_x, root_y, x, y; unsigned int mods; static Time buttonpress_time=0; static unsigned int clicks=1; /* this was set in get_com_char originally. Matthias */ refreshed = 0; /* no longer needed. Matthias */ /* XNextEvent(display,&event); */ switch(event.type) { case KeyPress: s = lookup_key(&event,&count, qt_c); send_string(s,count); return 0; case ClientMessage: if (event.xclient.format == 32 && event.xclient.data.l[0] == wm_del_win) clean_exit(0); return 0; case MappingNotify: XRefreshKeyboardMapping(&event.xmapping); return 0; case GraphicsExpose: case Expose: if (!size_set) { /* Force a window resize if an exposure event * arrives before the first resize event. */ resize_window(0,0); size_set = 1; } if(event.xany.window==vt_win) { scr_refresh(event.xexpose.x,event.xexpose.y, event.xexpose.width,event.xexpose.height); return 0; } /* no longer needed */ /* else */ /* { */ /* while(XCheckTypedWindowEvent (display, event.xany.window, Expose, */ /* &dummy)); */ /* while(XCheckTypedWindowEvent (display, event.xany.window, */ /* GraphicsExpose, &dummy)); */ /* } */ return 0; case VisibilityNotify: /* Here's my conclusiion: * If the window is completely onobscured, use bitblt's * to scroll. Even then, they're only used when doing partial * screen scrolling. When partially obscured, we have to fill * in the GraphicsExpose parts, which means that after each refresh, * we need to wait for the graphics expose or Noexpose events, * which ought to make things real slow! */ if(event.xvisibility.state == VisibilityUnobscured) { scr_refresh(0,0,MyWinInfo.cwidth,MyWinInfo.cheight); /* refresh_type = FAST; */ /* use slow here. FAST seems to be buggy sometimes. (Matthias) */ refresh_type = SLOW; } else if(event.xvisibility.state == VisibilityPartiallyObscured) { refresh_type = SLOW; scr_refresh(0,0,MyWinInfo.cwidth,MyWinInfo.cheight); } else { refresh_type = DONT_BOTHER; } break; case FocusIn: scr_focus(1); return 0; case FocusOut: scr_focus(0); return 0; case ConfigureNotify: resize_window(0,0); size_set = 1; return 0; case ButtonPress: if (event.xany.window == vt_win) { if (mouse_rep && ((event.xbutton.state & ShiftMask) == 0) && !mouse_block) { mouse_report (&(event.xbutton), 0); return 1; } else { switch (event.xbutton.button) { case Button1 : /* recognize multiclick. bmg */ if (event.xbutton.time-buttonpress_time < MULTICLICK_TIME) { clicks++; } else { clicks = 1; } /* don't react two times on the same event */ /* Matthias */ if (event.xbutton.time == buttonpress_time) clicks--; buttonpress_time = event.xbutton.time; scr_start_selection(clicks, event.xbutton.x,event.xbutton.y); return 0; /* deactivated since Button3 is for popupmenu. Matthias */ /* case Button3 : */ /* scr_extend_selection(event.xbutton.x,event.xbutton.y); */ /* Scroll up */ case Button4: MyWinInfo.offset += 3; /* check to make sure we aren't at the top already */ if (MyWinInfo.offset > MyWinInfo.sline_top) { MyWinInfo.offset = MyWinInfo.sline_top; } screen_refresh(); return 0; /* Scroll down */ case Button5: MyWinInfo.offset -= 3; /* check to make sure we aren't at the bottom already */ if (MyWinInfo.offset < 0) { MyWinInfo.offset = 0; } screen_refresh(); return 0; default: return 0; } } } return 0; case ButtonRelease: if (event.xany.window == vt_win) { if (mouse_rep && ((event.xbutton.state & ShiftMask) == 0) && !mouse_block) { mouse_report (&(event.xbutton), 1); return 1; } else { switch (event.xbutton.button) { case Button1: /* no longer needed bmg */ /* case Button3: */ scr_make_selection(event.xbutton.time); return 0; case Button2: if ((event.xbutton.state & Mod1Mask) == 0) scr_paste_selection(); return 0; } } } return 0; case MotionNotify: if (event.xany.window == vt_win && ((event.xbutton.state & Button1Mask) == Button1Mask) && !(event.xbutton.state & Button2Mask)) { while(XCheckTypedWindowEvent(display, vt_win, MotionNotify, &event)); XQueryPointer(display,vt_win,&root,&child, &root_x,&root_y,&x,&y,&mods); scr_extend_selection(x,y); return 0; } return 0; default: return 0; } return 0; }