コード例 #1
0
ファイル: rs-dir-selector.c プロジェクト: bgromov/rawstudio
/**
 * Callback after expanding a row
 * @param view A GtkTreeView
 * @param iter A GtkTreeIter
 * @param path A GtkTreePath
 * @param user_data A gpointer
 */
static void
row_expanded(GtkTreeView *view, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data)
{
	GtkTreeModel *model;
	GtkTreeIter empty;
	gchar *filepath;
	gchar *file;
	GDir *dir;
	GString *gs = NULL;

	/* Set busy cursor */	
	if (GDK_IS_WINDOW(GTK_WIDGET(view)->window))
	{
		GdkCursor* cursor = gdk_cursor_new(GDK_WATCH);
		gdk_window_set_cursor(gtk_widget_get_toplevel(GTK_WIDGET(view))->window, cursor);
		gdk_cursor_unref(cursor);
		gdk_flush();
	}

	model = gtk_tree_view_get_model(view);
	gtk_tree_model_iter_children(GTK_TREE_MODEL(model),
								 &empty, iter);
	gtk_tree_model_get(GTK_TREE_MODEL(model), iter,
					   COL_PATH, &filepath,
					   -1);

	dir = g_dir_open(filepath, 0, NULL);

	if (dir)
	{
		while ((file = (gchar *) g_dir_read_name(dir)))
		{
			gs = g_string_new(filepath);
			g_string_append(gs, file);
			g_string_append(gs, "/");
			if (g_file_test(gs->str, G_FILE_TEST_IS_DIR)) 
			{
				if (file[0] == '.') 
				{
					/* Fixme: If hidden files should be shown too */
				} 
				else
				{
					dir_selector_add_element(GTK_TREE_STORE(model), iter, file, gs->str);
				}
			}
			g_string_free(gs, TRUE);	
		}
		g_dir_close(dir);
		g_free(filepath);
	}
	if (GDK_IS_WINDOW(GTK_WIDGET(view)->window))
		gdk_window_set_cursor(gtk_widget_get_toplevel(GTK_WIDGET(view))->window, NULL);
	gtk_tree_store_remove(GTK_TREE_STORE(model), &empty);
}
コード例 #2
0
ファイル: gdkinput.c プロジェクト: Aridna/gtk2
gboolean
gdk_device_get_history  (GdkDevice         *device,
			 GdkWindow         *window,
			 guint32            start,
			 guint32            stop,
			 GdkTimeCoord    ***events,
			 gint              *n_events)
{
  g_return_val_if_fail (window != NULL, FALSE);
  g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
  g_return_val_if_fail (events != NULL, FALSE);
  g_return_val_if_fail (n_events != NULL, FALSE);

  if (n_events)
    *n_events = 0;
  if (events)
    *events = NULL;

  if (GDK_WINDOW_DESTROYED (window))
    return FALSE;
    
  if (GDK_IS_CORE (device))
    return FALSE;
  else
    return _gdk_device_get_history (device, window, start, stop, events, n_events);
}
コード例 #3
0
ファイル: gdkglwindow.c プロジェクト: ayyi/libwaveform
/**
 * gdk_gl_window_new:
 * @glconfig: a #GdkGLConfig.
 * @window: the #GdkWindow to be used as the rendering area.
 * @attrib_list: (array) (allow-none): this must be set to NULL or empty (first attribute of None).
 *
 * Creates an on-screen rendering area.
 * attrib_list is currently unused. This must be set to NULL or empty
 * (first attribute of None). See GLX 1.3 spec.
 *
 * Return value: the new #GdkGLWindow.
 **/
GdkGLWindow *
gdk_gl_window_new (GdkGLConfig *glconfig, GdkWindow *window, const int *attrib_list)
{
  GDK_GL_NOTE_FUNC ();

  g_return_val_if_fail (GDK_IS_GL_CONFIG (glconfig), NULL);
  g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);

  /*
   * Get X Window.
   */

  Window glxwindow = GDK_DRAWABLE_XID (GDK_DRAWABLE (window));

  /*
   * Instantiate the GdkGLWindowImplX11 object.
   */

  GdkGLWindow *glwindow = g_object_new (GDK_TYPE_GL_WINDOW, NULL);

  glwindow->drawable = GDK_DRAWABLE (window);
  g_object_add_weak_pointer (G_OBJECT (glwindow->drawable), (gpointer *) &(glwindow->drawable));

  glwindow->glxwindow = glxwindow;

  glwindow->glconfig = glconfig;
  g_object_ref (G_OBJECT (glwindow->glconfig));

  glwindow->is_destroyed = FALSE;

  return glwindow;
}
コード例 #4
0
void
gdk_property_change (GdkWindow    *window,
		     GdkAtom       property,
		     GdkAtom       type,
		     gint          format,
		     GdkPropMode   mode,
		     const guchar *data,
		     gint          nelements)
{
  GdkDisplay *display;
  Window xwindow;
  Atom xproperty;
  Atom xtype;

  g_return_if_fail (!window || GDK_IS_WINDOW (window));

  if (!window)
    {
      GdkScreen *screen;
      
      screen = gdk_screen_get_default ();
      window = gdk_screen_get_root_window (screen);
      
      GDK_NOTE (MULTIHEAD, g_message ("gdk_property_change(): window is NULL\n"));
    }


  if (GDK_WINDOW_DESTROYED (window))
    return;

  display = gdk_drawable_get_display (window);
  
  xproperty = gdk_x11_atom_to_xatom_for_display (display, property);
  xtype = gdk_x11_atom_to_xatom_for_display (display, type);
  xwindow = GDK_WINDOW_XID (window);

  if (xtype == XA_ATOM ||
      xtype == gdk_x11_get_xatom_by_name_for_display (display, "ATOM_PAIR"))
    {
      /*
       * data is an array of GdkAtom, we need to convert it
       * to an array of X Atoms
       */
      gint i;
      GdkAtom *atoms = (GdkAtom*) data;
      Atom *xatoms;

      xatoms = g_new (Atom, nelements);
      for (i = 0; i < nelements; i++)
	xatoms[i] = gdk_x11_atom_to_xatom_for_display (display, atoms[i]);

      XChangeProperty (GDK_DISPLAY_XDISPLAY (display), xwindow,
		       xproperty, xtype,
		       format, mode, (guchar *)xatoms, nelements);
      g_free (xatoms);
    }
  else
    XChangeProperty (GDK_DISPLAY_XDISPLAY (display), xwindow, xproperty, 
		     xtype, format, mode, (guchar *)data, nelements);
}
コード例 #5
0
ファイル: draganddrop.c プロジェクト: amery/clip-itk
int
clip_GDK_DRAGMOTION(ClipMachine * cm)
{
        C_object             *ccontext = _fetch_co_arg(cm);
        C_object             *cgdk_win = _fetch_cobject(cm, _clip_spar(cm, 2));
        GdkDragProtocol       protocol = _clip_parni(cm, 3);
        gint                    x_root = _clip_parni(cm, 4);
        gint                    y_root = _clip_parni(cm, 5);
        GdkDragAction suggested_action = _clip_parni(cm, 6);
        GdkDragAction possible_actions = _clip_parni(cm, 7);
        guint32                   time = _clip_parni(cm, 8);

	if (!ccontext || ccontext->type != GDK_TYPE_DRAG_CONTEXT)
        	goto err;
	CHECKCOBJ(cgdk_win, GDK_IS_WINDOW(cgdk_win->object));
	CHECKARG(3, NUMERIC_t); CHECKARG(4, NUMERIC_t);
	CHECKARG(5, NUMERIC_t); CHECKARG(6, NUMERIC_t);
	CHECKARG(7, NUMERIC_t); CHECKARG(8, NUMERIC_t);

        gdk_drag_motion((GdkDragContext*)ccontext->object,
        	GDK_WINDOW(cgdk_win->object),
        	protocol,
        	x_root, y_root,
        	suggested_action,
                possible_actions,
                time);

	return 0;
err:
	return 1;
}
コード例 #6
0
ファイル: gsb_status.c プロジェクト: wazari972/Grisbi
/**
 * Change current cursor to a animated watch (if animation supported
 * by environment).
 *
 * \param force_update		Call a gtk iteration to ensure cursor
 *				is updated.  May cause trouble if
 *				called from some signal handlers.
 */
void gsb_status_wait ( gboolean force_update )
{
    GdkWindow * current_window;

    gdk_window_set_cursor ( run.window -> window,
			    gdk_cursor_new_for_display ( gdk_display_get_default ( ),
							 GDK_WATCH ) );

    current_window = gdk_display_get_window_at_pointer ( gdk_display_get_default ( ),
							 NULL, NULL );

    if ( current_window && GDK_IS_WINDOW ( current_window )
     &&
	 current_window != run.window -> window )
    {
	GdkWindow * parent = gdk_window_get_toplevel ( current_window );

	if ( parent && parent != current_window )
	{
	    current_window = parent;
	}

	gdk_window_set_cursor ( current_window,
				gdk_cursor_new_for_display ( gdk_display_get_default ( ),
							     GDK_WATCH ) );

	tracked_window = current_window;
    }

    if ( force_update )
	update_gui ( );
}
コード例 #7
0
ファイル: FrameGdk.cpp プロジェクト: oroisec/ios
void FrameGdk::setFrameGeometry(const IntRect &r)
{
    if (!m_drawable || !GDK_IS_WINDOW(m_drawable))
        return;
    GdkWindow* window = GDK_WINDOW(m_drawable);
    gdk_window_move_resize(window, r.x(), r.y(), r.width(), r.height());
}
コード例 #8
0
ファイル: gdkselection-win32.c プロジェクト: My-Source/root
gint
gdk_selection_property_get(GdkWindow * requestor,
                           guchar ** data,
                           GdkAtom * ret_type, gint * ret_format)
{
   GdkSelProp *prop;

   g_return_val_if_fail(requestor != NULL, 0);
   g_return_val_if_fail(GDK_IS_WINDOW(requestor), 0);

   if (GDK_DRAWABLE_DESTROYED(requestor))
      return 0;

   GDK_NOTE(DND, g_print("gdk_selection_property_get: %#x",
                         GDK_DRAWABLE_XID(requestor)));

   prop =
       g_hash_table_lookup(sel_prop_table, &GDK_DRAWABLE_XID(requestor));

   if (prop == NULL) {
      GDK_NOTE(DND, g_print(": NULL\n"));
      *data = NULL;
      return 0;
   }
   GDK_NOTE(DND, g_print(": %d bytes\n", prop->length));
   *data = g_malloc(prop->length);
   if (prop->length > 0)
      memmove(*data, prop->data, prop->length);
   if (ret_type)
      *ret_type = prop->type;
   if (ret_format)
      *ret_format = prop->format;

   return prop->length;
}
コード例 #9
0
ファイル: gdkglwindow.c プロジェクト: alexmurray/gtkglext
/**
 * gdk_window_get_gl_window:
 * @window: a #GdkWindow.
 *
 * Returns the #GdkGLWindow held by the @window.
 *
 * Return value: the #GdkGLWindow.
 **/
GdkGLWindow *
gdk_window_get_gl_window (GdkWindow *window)
{
  g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);

  return g_object_get_qdata (G_OBJECT (window), quark_gl_window);
}
コード例 #10
0
ファイル: gdkglwindow.c プロジェクト: alexmurray/gtkglext
/**
 * gdk_window_is_gl_capable:
 * @window: a #GdkWindow.
 *
 * Returns whether the @window is OpenGL-capable.
 *
 * Return value: TRUE if the @window is OpenGL-capable, FALSE otherwise.
 **/
gboolean
gdk_window_is_gl_capable (GdkWindow *window)
{
  g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);

  return g_object_get_qdata (G_OBJECT (window), quark_gl_window) != NULL ? TRUE : FALSE;
}
コード例 #11
0
ファイル: gdkdisplay-directfb.c プロジェクト: Aridna/gtk2
GdkGrabStatus
gdk_directfb_keyboard_grab (GdkDisplay *display,
                            GdkWindow  *window,
                            gint        owner_events,
                            guint32     time)
{
  GdkWindow             *toplevel;
  GdkWindowImplDirectFB *impl;

  g_return_val_if_fail (GDK_IS_WINDOW (window), 0);

  if (_gdk_directfb_keyboard_grab_window)
    gdk_keyboard_ungrab (time);

  toplevel = gdk_directfb_window_find_toplevel (window);
  impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (toplevel)->impl);

  if (impl->window)
    {
      if (impl->window->GrabKeyboard (impl->window) == DFB_LOCKED)
        return GDK_GRAB_ALREADY_GRABBED;
    }

  _gdk_directfb_keyboard_grab_window = g_object_ref (window);
  _gdk_directfb_keyboard_grab_owner_events = owner_events;
  return GDK_GRAB_SUCCESS;
}
コード例 #12
0
void gtk_im_context_set_client_window (GtkIMContext *context,
          GdkWindow    *window)
{
    GtkIMContextClass *klass;
    g_return_if_fail (GTK_IS_IM_CONTEXT (context));
    klass = GTK_IM_CONTEXT_GET_CLASS (context);
    if (klass->set_client_window)
        klass->set_client_window (context, window);

    //below is our interposed codes to save the context to local_context.
    if(!GDK_IS_WINDOW (window))
        return;
    g_object_set_data(G_OBJECT(context),"window",window);
    int width = gdk_window_get_width(window);
    int height = gdk_window_get_height(window);
    if(width != 0 && height !=0) {
        gtk_im_context_focus_in(context);
        local_context = context;
    }
    //only add this event_filter when using 'fcitx' immodule.
    //for xim immodule, this function is as same as original from gtk2.
    const gchar * immodule = g_getenv("GTK_IM_MODULE");
    if(immodule && !strcmp(immodule, "fcitx")) {
        gdk_window_add_filter (window, event_filter, context);
    }
}
コード例 #13
0
ファイル: gtkdragdest.c プロジェクト: endlessm/gtk
/**
 * gtk_drag_dest_set_proxy: (method)
 * @widget: a #GtkWidget
 * @proxy_window: the window to which to forward drag events
 * @protocol: the drag protocol which the @proxy_window accepts
 *   (You can use gdk_drag_get_protocol() to determine this)
 * @use_coordinates: If %TRUE, send the same coordinates to the
 *   destination, because it is an embedded
 *   subwindow.
 *
 * Sets this widget as a proxy for drops to another window.
 *
 * Deprecated: 3.22
 */
void
gtk_drag_dest_set_proxy (GtkWidget       *widget,
                         GdkWindow       *proxy_window,
                         GdkDragProtocol  protocol,
                         gboolean         use_coordinates)
{
  GtkDragDestSite *site;

  g_return_if_fail (GTK_IS_WIDGET (widget));
  g_return_if_fail (!proxy_window || GDK_IS_WINDOW (proxy_window));

  site = g_slice_new (GtkDragDestSite);

  site->flags = 0;
  site->have_drag = FALSE;
  site->target_list = NULL;
  site->actions = 0;
  site->proxy_window = proxy_window;
  if (proxy_window)
    g_object_ref (proxy_window);
  site->do_proxy = TRUE;
  site->proxy_protocol = protocol;
  site->proxy_coords = use_coordinates;
  site->track_motion = FALSE;

  gtk_drag_dest_set_internal (widget, site);
}
コード例 #14
0
ファイル: gtkxembed.c プロジェクト: endlessm/gtk
/**
 * _gtk_xembed_send_focus_message:
 * @recipient: (allow-none): window to which to send the window, or %NULL
 *             in which case nothing will be sent
 * @message_type:   type of message
 * @detail:    detail field of message
 * 
 * Sends a XEMBED message for moving the focus along the focus
 * chain to a window. The flags field that these messages share
 * will be correctly filled in.
 **/
void
_gtk_xembed_send_focus_message (GdkWindow        *recipient,
				XEmbedMessageType message_type,
				glong             detail)
{
  gulong flags = 0;

  if (!recipient)
    return;

  g_return_if_fail (GDK_IS_WINDOW (recipient));
  g_return_if_fail (message_type == XEMBED_FOCUS_IN ||
                    message_type == XEMBED_FOCUS_NEXT ||
                    message_type == XEMBED_FOCUS_PREV);

  if (current_messages)
    {
      GtkXEmbedMessage *message = current_messages->data;
      switch (message->message)
	{
	case XEMBED_FOCUS_IN:
	case XEMBED_FOCUS_NEXT:
	case XEMBED_FOCUS_PREV:
	  flags = message->data1 & XEMBED_FOCUS_WRAPAROUND;
	  break;
	default:
	  break;
	}
    }

  _gtk_xembed_send_message (recipient, message_type, detail, flags, 0);
}
コード例 #15
0
ファイル: draganddrop.c プロジェクト: amery/clip-itk
int
clip_GDK_DRAGFINDWINDOW(ClipMachine * cm)
{
        C_object *ccontext = _fetch_co_arg(cm);
        C_object *cgdk_win = _fetch_cobject(cm, _clip_spar(cm, 2));
        gint        x_root = _clip_parni(cm, 3);
        gint        y_root = _clip_parni(cm, 4);
        ClipVar        *cv = _clip_spar(cm, 5);
        GdkWindow     *win ;
        C_object     *cwin ;
        GdkDragProtocol protocol ;

	if (!ccontext || ccontext->type != GDK_TYPE_DRAG_CONTEXT)
        	goto err;
	CHECKCOBJ(cgdk_win, GDK_IS_WINDOW(cgdk_win->object));
	CHECKARG(3, NUMERIC_t);
	CHECKARG(4, NUMERIC_t);

        gdk_drag_find_window((GdkDragContext*)ccontext->object,
        	GDK_WINDOW(cgdk_win->object),
        	x_root, y_root,
        	&win, &protocol);

	if (win)
        {
        	cwin = _list_get_cobject(cm, win);
        	if (!cwin) cwin = _register_object(cm, win, GDK_TYPE_WINDOW, NULL, NULL);
                if (cwin) _clip_mclone(cm, cv, &cwin->obj);
                _clip_storni(cm, protocol, 6, 0);
        }
	return 0;
err:
	return 1;
}
コード例 #16
0
ファイル: gdkgeometry-win32.c プロジェクト: 3v1n0/gtk
void
_gdk_win32_window_tmp_unset_bg (GdkWindow *window,
				gboolean recurse)
{
  g_return_if_fail (GDK_IS_WINDOW (window));

  if (window->input_only || window->destroyed ||
      (window->window_type != GDK_WINDOW_ROOT &&
       !GDK_WINDOW_IS_MAPPED (window)))
    return;

  if (_gdk_window_has_impl (window) &&
      GDK_WINDOW_IS_WIN32 (window) &&
      window->window_type != GDK_WINDOW_ROOT &&
      window->window_type != GDK_WINDOW_FOREIGN)
    tmp_unset_bg (window);

  if (recurse)
    {
      GList *l;

      for (l = window->children; l != NULL; l = l->next)
	_gdk_win32_window_tmp_unset_bg (l->data, TRUE);
    }
}
コード例 #17
0
ファイル: gdkselection-wayland.c プロジェクト: 3v1n0/gtk
void
gdk_wayland_selection_add_targets (GdkWindow *window,
                                   GdkAtom    selection,
                                   guint      ntargets,
                                   GdkAtom   *targets)
{
  struct wl_data_source *data_source;
  guint i;

  g_return_if_fail (GDK_IS_WINDOW (window));

  data_source = gdk_wayland_selection_get_data_source (window, selection);

  if (!data_source)
    return;

  for (i = 0; i < ntargets; i++)
    wl_data_source_offer (data_source, gdk_atom_name (targets[i]));

  if (selection == atoms[ATOM_CLIPBOARD])
    {
      GdkDeviceManager *device_manager;
      GdkDisplay *display;
      GdkDevice *device;

      display = gdk_window_get_display (window);
      device_manager = gdk_display_get_device_manager (display);
      device = gdk_device_manager_get_client_pointer (device_manager);
      gdk_wayland_device_set_selection (device, data_source);
    }
}
コード例 #18
0
ファイル: gdkeventsource.c プロジェクト: Vort/gtk
static GdkWindow *
gdk_event_source_get_filter_window (GdkEventSource      *event_source,
                                    XEvent              *xevent,
                                    GdkEventTranslator **event_translator)
{
  GList *list = event_source->translators;
  GdkWindow *window;

  *event_translator = NULL;

  while (list)
    {
      GdkEventTranslator *translator = list->data;

      list = list->next;
      window = _gdk_x11_event_translator_get_window (translator,
                                                     event_source->display,
                                                     xevent);
      if (window)
        {
          *event_translator = translator;
          return window;
        }
    }

  window = gdk_x11_window_lookup_for_display (event_source->display,
                                              xevent->xany.window);

  if (window && !GDK_IS_WINDOW (window))
    window = NULL;

  return window;
}
コード例 #19
0
ファイル: eggtraymanager.c プロジェクト: micove/awn-extras
static void
egg_tray_manager_unmanage (EggTrayManager *manager)
{
#ifdef GDK_WINDOWING_X11
  Display *display;
  guint32 timestamp;
  GtkWidget *invisible;

  if (manager->invisible == NULL)
    return;

  invisible = manager->invisible;
  g_assert (GTK_IS_INVISIBLE (invisible));
  g_assert (GTK_WIDGET_REALIZED (invisible));
  g_assert (GDK_IS_WINDOW (invisible->window));
  
  display = GDK_WINDOW_XDISPLAY (invisible->window);
  
  if (XGetSelectionOwner (display, manager->selection_atom) ==
      GDK_WINDOW_XWINDOW (invisible->window))
    {
      timestamp = gdk_x11_get_server_time (invisible->window);      
      XSetSelectionOwner (display, manager->selection_atom, None, timestamp);
    }

  gdk_window_remove_filter (invisible->window, egg_tray_manager_window_filter, manager);  

  manager->invisible = NULL; /* prior to destroy for reentrancy paranoia */
  gtk_widget_destroy (invisible);
  g_object_unref (G_OBJECT (invisible));
#endif
}
コード例 #20
0
void
gdk_property_delete (GdkWindow *window,
		     GdkAtom    property)
{
  g_return_if_fail (!window || GDK_IS_WINDOW (window));

  if (!window)
    {
      GdkScreen *screen = gdk_screen_get_default ();
      window = gdk_screen_get_root_window (screen);
      
      GDK_NOTE (MULTIHEAD, 
		g_message ("gdk_property_delete(): window is NULL\n"));
    }

  if (GDK_WINDOW_DESTROYED (window))
    return;

  gi_atom_id_t aid;
  GdkDisplay *display = GDK_DISPLAY_OBJECT(_gdk_display);

  aid = gdk_x11_atom_to_xatom_for_display (display, property);

  gi_delete_property ( GDK_DRAWABLE_GIX_ID (window), aid);
}
コード例 #21
0
ファイル: gdkwindow.c プロジェクト: amery/clip-itk
CLIP_DLLEXPORT int
gdk_object_window_destructor(ClipMachine *cm, C_object *cwin)
{
	if (cwin && GDK_IS_WINDOW(cwin) && cwin->ref_count >= 0)
		gdk_window_unref(GDK_WINDOW(cwin->object));
	return 0;
}
コード例 #22
0
ファイル: PageGdk.cpp プロジェクト: oroisec/ios
void Page::setWindowRect(const FloatRect& r)
{
    GdkDrawable* drawable = rootWindowForFrame(mainFrame());
    if (!drawable || !GDK_IS_WINDOW(drawable))
        return;
    GdkWindow* window = GDK_WINDOW(drawable);
    gdk_window_move_resize(window, (int)r.x(), (int)r.y(), (int)r.width(), (int)r.height());
}
コード例 #23
0
ファイル: byzanzrecorder.c プロジェクト: npnth/bysans
ByzanzRecorder *
byzanz_recorder_new (GdkWindow *window, cairo_rectangle_int_t *area)
{
  g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
  g_return_val_if_fail (area != NULL, NULL);

  return g_object_new (BYZANZ_TYPE_RECORDER, "window", window, "area", area, NULL);
}
コード例 #24
0
GdkWindow* ada_window_from_pyobject (PyObject* object) {
   GObject* obj = ada_widget_from_pyobject (object);
   if (obj && GDK_IS_WINDOW(obj)) {
      return (GdkWindow*)obj;
   } else {
      return (GdkWindow*)NULL;
   }
}
コード例 #25
0
std::unique_ptr<RedirectedXCompositeWindow> RedirectedXCompositeWindow::create(WebPageProxy& webPage, const IntSize& initialSize, std::function<void()>&& damageNotify)
{
    GdkWindow* parentWindow = gtk_widget_get_parent_window(webPage.viewWidget());
    ASSERT(GDK_IS_WINDOW(parentWindow));
    if (!supportsXDamageAndXComposite(parentWindow))
        return nullptr;
    return std::unique_ptr<RedirectedXCompositeWindow>(new RedirectedXCompositeWindow(webPage, initialSize, WTFMove(damageNotify)));
}
コード例 #26
0
ファイル: panel-xutils.c プロジェクト: City-busz/mate-panel
void
panel_xutils_set_strut (GdkWindow        *gdk_window,
			PanelOrientation  orientation,
			guint32           strut,
			guint32           strut_start,
			guint32           strut_end)
 {
	Display *display;
	Window   window;
	gulong   struts [12] = { 0, };

	g_return_if_fail (GDK_IS_WINDOW (gdk_window));

	display = GDK_WINDOW_XDISPLAY (gdk_window);
	window = GDK_WINDOW_XID (gdk_window);

	if (net_wm_strut == None)
		net_wm_strut = XInternAtom (display, "_NET_WM_STRUT", False);
	if (net_wm_strut_partial == None)
		net_wm_strut_partial = XInternAtom (display, "_NET_WM_STRUT_PARTIAL", False);

	switch (orientation) {
	case PANEL_ORIENTATION_LEFT:
		struts [STRUT_LEFT] = strut;
		struts [STRUT_LEFT_START] = strut_start;
		struts [STRUT_LEFT_END] = strut_end;
		break;
	case PANEL_ORIENTATION_RIGHT:
		struts [STRUT_RIGHT] = strut;
		struts [STRUT_RIGHT_START] = strut_start;
		struts [STRUT_RIGHT_END] = strut_end;
		break;
	case PANEL_ORIENTATION_TOP:
		struts [STRUT_TOP] = strut;
		struts [STRUT_TOP_START] = strut_start;
		struts [STRUT_TOP_END] = strut_end;
		break;
	case PANEL_ORIENTATION_BOTTOM:
		struts [STRUT_BOTTOM] = strut;
		struts [STRUT_BOTTOM_START] = strut_start;
		struts [STRUT_BOTTOM_END] = strut_end;
		break;
	}

	gdk_error_trap_push ();
	XChangeProperty (display, window, net_wm_strut,
			 XA_CARDINAL, 32, PropModeReplace,
			 (guchar *) &struts, 4);
	XChangeProperty (display, window, net_wm_strut_partial,
			 XA_CARDINAL, 32, PropModeReplace,
			 (guchar *) &struts, 12);
#if GTK_CHECK_VERSION (3, 0, 0)
	gdk_error_trap_pop_ignored ();
#else
	gdk_error_trap_pop ();
#endif
}
コード例 #27
0
ファイル: sublime-imfix.c プロジェクト: shadowlaser/linux-stu
static GdkFilterReturn event_filter (GdkXEvent *xevent, GdkEvent *event, gpointer im_context)
{
    XEvent *xev = (XEvent *)xevent;
    if(xev->type == KeyRelease && GTK_IS_IM_CONTEXT(im_context)) {
       GdkWindow * win = g_object_get_data(G_OBJECT(im_context),"window");
       if(GDK_IS_WINDOW(win))
         gtk_im_context_set_client_window(im_context, win);
    }
    return GDK_FILTER_CONTINUE;
}
コード例 #28
0
static GSList*
test_find_widget_input_windows (GtkWidget *widget,
                                gboolean   input_only)
{
  GList *node, *children;
  GSList *matches = NULL;
  gpointer udata;
  gdk_window_get_user_data (widget->window, &udata);
  if (udata == widget && (!input_only || (GDK_IS_WINDOW (widget->window) && GDK_WINDOW_OBJECT (widget->window)->input_only)))
    matches = g_slist_prepend (matches, widget->window);
  children = gdk_window_get_children (gtk_widget_get_parent_window (widget));
  for (node = children; node; node = node->next)
    {
      gdk_window_get_user_data (node->data, &udata);
      if (udata == widget && (!input_only || (GDK_IS_WINDOW (node->data) && GDK_WINDOW_OBJECT (node->data)->input_only)))
        matches = g_slist_prepend (matches, node->data);
    }
  return g_slist_reverse (matches);
}
コード例 #29
0
ファイル: xp_theme.c プロジェクト: Aridna/gtk2
gboolean
xp_theme_draw (GdkWindow *win, XpThemeElement element, GtkStyle *style,
	       int x, int y, int width, int height,
	       GtkStateType state_type, GdkRectangle *area)
{
  HTHEME theme;
  RECT rect, clip, *pClip;
  HDC dc;
  XpDCInfo dc_info;
  int part_state;

  if (!xp_theme_is_drawable (element))
    return FALSE;

  theme = xp_theme_get_handle_by_element (element);
  if (!theme)
    return FALSE;

  /* FIXME: Recheck its function */
  if (GDK_IS_WINDOW (win) && gdk_win32_window_is_win32 (win))
  enable_theme_dialog_texture_func (GDK_WINDOW_HWND (win), ETDT_ENABLETAB);

  dc = get_window_dc (style, win, state_type, &dc_info,
		      x, y, width, height,
		      &rect);
  if (!dc)
    return FALSE;

  if (area)
    {
      clip.left = area->x - dc_info.x_offset;
      clip.top = area->y - dc_info.y_offset;
      clip.right = clip.left + area->width;
      clip.bottom = clip.top + area->height;

      pClip = &clip;
    }
  else
    {
      pClip = NULL;
    }

  part_state = xp_theme_map_gtk_state (element, state_type);

  /* Support transparency */
  if (is_theme_partially_transparent_func (theme, element_part_map[element], part_state))
    draw_theme_parent_background_func (GDK_WINDOW_HWND (win), dc, pClip);

  draw_theme_background_func (theme, dc, element_part_map[element],
			      part_state, &rect, pClip);

  release_window_dc (&dc_info);

  return TRUE;
}
コード例 #30
0
GdkGrabStatus
gdk_keyboard_grab (GdkWindow *	   window,
		   gboolean	   owner_events,
		   guint32	   time)
{
  gint return_val;
  unsigned long serial;
  GdkDisplay *display;
  GdkDisplayX11 *display_x11;
  GdkWindow *native;

  g_return_val_if_fail (window != NULL, 0);
  g_return_val_if_fail (GDK_IS_WINDOW (window), 0);

  native = gdk_window_get_toplevel (window);

  /* TODO: What do we do for offscreens and  children? We need to proxy the grab somehow */
  if (!GDK_IS_WINDOW_IMPL_X11 (GDK_WINDOW_OBJECT (native)->impl))
    return GDK_GRAB_SUCCESS;

  display = GDK_WINDOW_DISPLAY (native);
  display_x11 = GDK_DISPLAY_X11 (display);

  serial = NextRequest (GDK_WINDOW_XDISPLAY (native));

  if (!GDK_WINDOW_DESTROYED (native))
    {
#ifdef G_ENABLE_DEBUG
      if (_gdk_debug_flags & GDK_DEBUG_NOGRABS)
	return_val = GrabSuccess;
      else
#endif
	return_val = XGrabKeyboard (GDK_WINDOW_XDISPLAY (native),
				    GDK_WINDOW_XID (native),
				    owner_events,
				    GrabModeAsync, GrabModeAsync,
				    time);
	if (G_UNLIKELY (!display_x11->trusted_client && 
			return_val == AlreadyGrabbed))
	  /* we can't grab the keyboard, but we can do a GTK-local grab */
	  return_val = GrabSuccess;
    }
  else
    return_val = AlreadyGrabbed;

  if (return_val == GrabSuccess)
    _gdk_display_set_has_keyboard_grab (display,
					window,	native,
					owner_events,
					serial, time);

  return gdk_x11_convert_grab_status (return_val);
}