Esempio n. 1
0
/**
 * Resize window to accommodate maximum number of address entries.
 * \param cw Completion window.
 */
static void addrcompl_resize_window( CompletionWindow *cw ) {
	GtkRequisition r;
	gint x, y, width, height, depth;

	/* Get current geometry of window */
#if !GTK_CHECK_VERSION(3, 0, 0)
	gdk_window_get_geometry( gtk_widget_get_window( cw->window ), &x, &y, &width, &height, &depth );
#else
	gdk_window_get_geometry( gtk_widget_get_window( cw->window ), &x, &y, &width, &height );
#endif

	gtk_widget_queue_resize_no_redraw(cw->list_view);
	gtk_widget_size_request( cw->list_view, &r );

	/* Adjust window height to available screen space */
	if( y + r.height > gdk_screen_height())
		r.height = gdk_screen_height() - y;

	gtk_widget_set_size_request(cw->window, width, r.height);

	gdk_pointer_grab(gtk_widget_get_window(cw->window), TRUE,
			 GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK |
			 GDK_BUTTON_RELEASE_MASK,
			 NULL, NULL, GDK_CURRENT_TIME);
	gdk_keyboard_grab(gtk_widget_get_window(cw->window), FALSE, GDK_CURRENT_TIME);
	gtk_grab_add(cw->window);

}
Esempio n. 2
0
G_MODULE_EXPORT void 
gw_radicalswindow_show_cb (GtkWidget *widget, gpointer data)
{
    //Declarations
    GtkWindow *window;
    GtkScrolledWindow *scrolledwindow;
    GtkPolicyType policy;
    int x, y, width, height, max_height;

    //Initializations
    window = GTK_WINDOW (widget);
    if (window == NULL) return;
    scrolledwindow = GTK_SCROLLED_WINDOW (data);
    gtk_scrolled_window_get_policy (scrolledwindow, NULL, &policy);

    gtk_scrolled_window_set_policy (scrolledwindow, GTK_POLICY_NEVER, GTK_POLICY_NEVER);
    gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
    gtk_window_get_position (window, &x, &y);
    gtk_window_get_size (window, &width, &height);
    max_height = gdk_screen_height () - y;
    if (max_height > 50) max_height -= 50;

    if (height > max_height)
    {
      gtk_scrolled_window_set_policy (scrolledwindow, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
      gtk_window_resize (GTK_WINDOW (window), width, max_height);
    }
    else
    {
      gtk_scrolled_window_set_policy (scrolledwindow, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
    }

    return;
}
static void
item_added_cb (EggToolbarsModel   *model,
	       int                 tpos,
	       int                 ipos,
	       EggEditableToolbar *etoolbar)
{
  GtkWidget *dock;
  GtkWidget *toolbar;
  GtkToolItem *item;

  toolbar = get_toolbar_nth (etoolbar, tpos);
  item = create_item_from_position (etoolbar, tpos, ipos);
  if (item == NULL) return;

  gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, ipos);

  connect_widget_signals (GTK_WIDGET (item), etoolbar);
  configure_item_tooltip (item);
  configure_item_cursor (item, etoolbar);
  configure_item_sensitivity (item, etoolbar);

  dock = get_dock_nth (etoolbar, tpos);
  gtk_widget_set_size_request (dock, -1, -1);
  gtk_widget_queue_resize_no_redraw (dock);

  toolbar_visibility_refresh (etoolbar);
}
Esempio n. 4
0
void
uim_cand_win_gtk_layout(UIMCandWinGtk *cwin,
                        gint topwin_x, gint topwin_y,
                        gint topwin_width, gint topwin_height)
{
    GtkRequisition req;
    int  x, y;
    int  cursor_x, cursor_y;
    int  sc_he, cw_he; /*screen height, candidate window height*/
    int  sc_wi, cw_wi;

    g_return_if_fail(UIM_IS_CAND_WIN_GTK(cwin));

#if GTK_CHECK_VERSION(3, 0, 0)
    gtk_widget_get_preferred_size(GTK_WIDGET(cwin), &req, NULL);
#else
    gtk_widget_size_request(GTK_WIDGET(cwin), &req);
#endif
    cw_wi = req.width;
    cw_he = req.height;

    sc_he = gdk_screen_get_height(gdk_screen_get_default ());
    sc_wi = gdk_screen_get_width (gdk_screen_get_default ());

    /* FIXME */
    switch (cwin->position) {
    case UIM_CAND_WIN_POS_LEFT:
        cursor_x = 0;
        break;
    case UIM_CAND_WIN_POS_RIGHT:
        cursor_x = topwin_width - cw_wi;
        break;
    default:
        cursor_x = cwin->cursor.x;
        break;
    }
    cursor_y = cwin->cursor.y;

    if (sc_wi <  topwin_x + cursor_x + cw_wi) {
        /* x = topwin_x + cursor_x - cw_wi; */
        x = sc_wi - cw_wi;
    } else {
        x = topwin_x + cursor_x;
    }

    if (sc_he <  topwin_y + cursor_y +  cwin->cursor.height + cw_he) {
        y = topwin_y + cursor_y - cw_he;
    } else {
        y = topwin_y + cursor_y +  cwin->cursor.height;
    }

    gtk_window_move(GTK_WINDOW(cwin), x, y);
#if GTK_CHECK_VERSION(3, 7, 8)
    if (gtk_widget_get_mapped(cwin->view) && GTK_IS_TREE_VIEW(cwin->view))
        gtk_widget_queue_resize_no_redraw(cwin->view);
#endif

    uim_cand_win_gtk_layout_sub_window(cwin);
}
Esempio n. 5
0
static gboolean
cb_unset_size (gpointer data)
{
  GtkWidget *widget = data;

  gtk_widget_queue_resize_no_redraw (widget);

  return FALSE;
}
Esempio n. 6
0
/* Remove a square corresponding to a removed process in the list */
void drawing_remove_square(histoDrawing_t *drawing,
        guint y,
        guint height)
{
  GdkPixmap *pixmap;

  if(unlikely((guint)drawing->height == height)) {
    //pixmap = gdk_pixmap_new(
    //    drawing->drawing_area->window,
    //    drawing->width + SAFETY,
    //    1,
    //    -1);
    pixmap = drawing->pixmap;
    drawing->height=1;
  } else {
    /* Allocate a new pixmap with new height */
     //pixmap = gdk_pixmap_new(
     //   drawing->drawing_area->window,
     //   drawing->width + SAFETY,
     //   drawing->height - height,
     //   -1);
     /* Keep the same preallocated pixmap */
    pixmap = drawing->pixmap;
   
    /* Copy the high region */
    gdk_draw_pixmap (pixmap,
      drawing->drawing_area->style->black_gc,
      drawing->pixmap,
      0, 0,
      0, 0,
      drawing->width + SAFETY, y);

    /* Copy up the bottom of the region */
    gdk_draw_pixmap (pixmap,
      drawing->drawing_area->style->black_gc,
      drawing->pixmap,
      0, y + height,
      0, y,
      drawing->width, drawing->height - y - height);

    drawing->height-=height;
  }

  //if(likely(drawing->pixmap))
  //  gdk_pixmap_unref(drawing->pixmap);

  //drawing->pixmap = pixmap;
  
  gtk_widget_set_size_request(drawing->drawing_area,
                             -1,
                             drawing->height);
  gtk_widget_queue_resize_no_redraw(drawing->drawing_area);
  /* ask for the buffer to be redrawn */
  gtk_widget_queue_draw_area ( drawing->drawing_area,
                               0, y,
                               drawing->width, MAX(drawing->height-y, 1));
}
Esempio n. 7
0
void ChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const
{
    // We need to queue a resize request only if the size changed,
    // otherwise we get into an infinite loop!
    GtkWidget* widget = GTK_WIDGET(m_webView);
    if (gtk_widget_get_realized(widget)
        && (widget->requisition.height != size.height())
        || (widget->requisition.width != size.width()))
        gtk_widget_queue_resize_no_redraw(widget);
}
Esempio n. 8
0
static void
candwin_show_page(gchar **str)
{
  int page;

  sscanf(str[1], "%d", &page);

  uim_cand_win_gtk_set_page(cwin, page);
  gtk_widget_show_all(GTK_WIDGET(cwin));
#if GTK_CHECK_VERSION(3, 7, 8)
  gtk_widget_queue_resize_no_redraw(cwin->view);
#endif
}
Esempio n. 9
0
static void scroll_adjust(GtkWidget* widget, void* data)
{
    const AdjustData* p = static_cast<AdjustData*>(data);
    widget->allocation.x += p->dx;
    widget->allocation.y += p->dy;

    if (widget->window == p->window)
    {
        // GtkFrame requires a queue_resize, otherwise parts of
        // the frame newly exposed by the scroll are not drawn.
        // To be safe, do it for all widgets.
        gtk_widget_queue_resize_no_redraw(widget);
        if (GTK_IS_CONTAINER(widget))
            gtk_container_forall(GTK_CONTAINER(widget), scroll_adjust, data);
    }
}
void ChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const
{
    // We need to queue a resize request only if the size changed,
    // otherwise we get into an infinite loop!
    GtkWidget* widget = GTK_WIDGET(m_webView);
    GtkRequisition requisition;
#if GTK_CHECK_VERSION(2, 20, 0)
    gtk_widget_get_requisition(widget, &requisition);
#else
    requisition = widget->requisition;
#endif
    if (gtk_widget_get_realized(widget)
        && (requisition.height != size.height())
        || (requisition.width != size.width()))
        gtk_widget_queue_resize_no_redraw(widget);
}
static void
update_fixed (EggEditableToolbar *etoolbar)
{
  GtkWidget *toolbar, *dock;
  if (!etoolbar->priv->fixed_toolbar) return;

  toolbar = etoolbar->priv->fixed_toolbar;
  dock = get_dock_nth (etoolbar, 0);

  if (dock && toolbar && gtk_widget_get_parent (toolbar) == NULL)
    {
      gtk_box_pack_end (GTK_BOX (dock), toolbar, FALSE, TRUE, 0);

      gtk_widget_show (toolbar);

      gtk_widget_set_size_request (dock, -1, -1);
      gtk_widget_queue_resize_no_redraw (dock);
    }
}
void ChromeClient::paint(WebCore::Timer<ChromeClient>*)
{
    static const double minimumFrameInterval = 1.0 / 60.0; // No more than 60 frames a second.
    double timeSinceLastDisplay = currentTime() - m_lastDisplayTime;
    double timeUntilNextDisplay = minimumFrameInterval - timeSinceLastDisplay;

    if (timeUntilNextDisplay > 0 && !m_forcePaint) {
        m_displayTimer.startOneShot(timeUntilNextDisplay);
        return;
    }

    Frame* frame = core(m_webView)->mainFrame();
    if (!frame || !frame->contentRenderer() || !frame->view())
        return;

    frame->view()->updateLayoutAndStyleIfNeededRecursive();
    performAllPendingScrolls();
    paintWebView(m_webView, frame, m_dirtyRegion);

    HashSet<GtkWidget*> children = m_webView->priv->children;
    HashSet<GtkWidget*>::const_iterator end = children.end();
    for (HashSet<GtkWidget*>::const_iterator current = children.begin(); current != end; ++current) {
        if (static_cast<GtkAllocation*>(g_object_get_data(G_OBJECT(*current), "delayed-allocation"))) {
            gtk_widget_queue_resize_no_redraw(GTK_WIDGET(m_webView));
            break;
        }
    }

    const IntRect& rect = m_dirtyRegion.bounds();
    gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), rect.x(), rect.y(), rect.width(), rect.height());

    m_dirtyRegion = Region();
    m_lastDisplayTime = currentTime();
    m_repaintSoonSourceId = 0;

    // We update the IM context window location here, because we want it to be
    // synced with cursor movement. For instance, a text field can move without
    // the selection changing.
    Frame* focusedFrame = core(m_webView)->focusController()->focusedOrMainFrame();
    if (focusedFrame && focusedFrame->editor().canEdit())
        m_webView->priv->imFilter.setCursorRect(frame->selection()->absoluteCaretBounds());
}
void ChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const
{
    if (m_adjustmentWatcher.scrollbarsDisabled())
        return;

    // We need to queue a resize request only if the size changed,
    // otherwise we get into an infinite loop!
    GtkWidget* widget = GTK_WIDGET(m_webView);
    GtkRequisition requisition;
    gtk_widget_get_preferred_size(widget, &requisition, 0);
    if (gtk_widget_get_realized(widget)
        && (requisition.height != size.height()
        || requisition.width != size.width()))
        gtk_widget_queue_resize_no_redraw(widget);

    // If this was a main frame size change, update the scrollbars.
    if (frame != frame->page()->mainFrame())
        return;
    m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater();
}
Esempio n. 14
0
static VALUE
rg_queue_resize_no_redraw(VALUE self)
{
    gtk_widget_queue_resize_no_redraw(_SELF(self));
    return self;
}
Esempio n. 15
0
/* Applies to whole drawing->width */
void drawing_insert_square(histoDrawing_t *drawing,
        guint y,
        guint height)
{
  //GdkRectangle update_rect;
  gboolean reallocate = FALSE;
  GdkPixmap *new_pixmap;

  /* Allocate a new pixmap with new height */
  if(drawing->alloc_height < drawing->height + height) {

    new_pixmap = gdk_pixmap_new(drawing->drawing_area->window,
                                     drawing->width + SAFETY + EXTRA_ALLOC,
                                     drawing->height + height + EXTRA_ALLOC,
                                     -1);
    drawing->alloc_width = drawing->width + SAFETY + EXTRA_ALLOC;
    drawing->alloc_height = drawing->height + height + EXTRA_ALLOC;
    reallocate = TRUE;

    /* Copy the high region */
    gdk_draw_pixmap (new_pixmap,
      drawing->drawing_area->style->black_gc,
      drawing->pixmap,
      0, 0,
      0, 0,
      drawing->width + SAFETY, y);

  } else {
    new_pixmap = drawing->pixmap;
  }

  //GdkPixmap *pixmap = gdk_pixmap_new(drawing->drawing_area->window,
  //      drawing->width + SAFETY,
  //      drawing->height + height,
  //      -1);
  
  /* add an empty square */
  gdk_draw_rectangle (new_pixmap,
    drawing->drawing_area->style->black_gc,
    TRUE,
    0, y,
    drawing->width + SAFETY,  // do not overlap
    height);

  /* copy the bottom of the region */
  gdk_draw_pixmap (new_pixmap,
    drawing->drawing_area->style->black_gc,
    drawing->pixmap,
    0, y,
    0, y + height,
    drawing->width+SAFETY, drawing->height - y);


  if(reallocate && likely(drawing->pixmap)) {
    gdk_pixmap_unref(drawing->pixmap);
    drawing->pixmap = new_pixmap;
  }
  
  if(unlikely(drawing->height==1)) drawing->height = height;
  else drawing->height += height;
  
  gtk_widget_set_size_request(drawing->drawing_area,
                             -1,
                             drawing->height);
  gtk_widget_queue_resize_no_redraw(drawing->drawing_area);
  
  /* ask for the buffer to be redrawn */
  gtk_widget_queue_draw_area ( drawing->drawing_area,
                               0, y,
                               drawing->width, drawing->height-y);
}