示例#1
0
文件: dock.c 项目: gentoo/pornview
static void
dock_setup_properties (GdkWindow * window)
{
    glong   data[1];
    GdkAtom kwm_dockwindow_atom;
    GdkAtom kde_net_system_tray_window_for_atom;

    kwm_dockwindow_atom = gdk_atom_intern ("KWM_DOCKWINDOW", FALSE);
    kde_net_system_tray_window_for_atom =
	gdk_atom_intern ("_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", FALSE);

    /*
     * this is the old KDE 1.0 and GNOME 1.2 way... 
     */
    data[0] = TRUE;
    gdk_property_change (window, kwm_dockwindow_atom,
			 kwm_dockwindow_atom, 32, GDK_PROP_MODE_REPLACE,
			 (guchar *) & data, 1);

    /*
     * this is needed to support KDE 2.0 
     */
    data[0] = 0;
    gdk_property_change (window, kde_net_system_tray_window_for_atom,
			 XA_WINDOW, 32, GDK_PROP_MODE_REPLACE,
			 (guchar *) & data, 1);
}
static gboolean dnd_source_set_raw(GdkWindow *requestor, GdkAtom property, GdkAtom target)
{
    gchar *target_name = gdk_atom_name(target);
    jobject data = dnd_source_get_data(target_name);
    gboolean is_data_set = FALSE;
    if (data) {
        if (mainEnv->IsInstanceOf(data, jStringCls)) {
            const char *cstring = mainEnv->GetStringUTFChars((jstring)data, NULL);

            gdk_property_change(requestor, property, GDK_SELECTION_TYPE_STRING,
                    8, GDK_PROP_MODE_REPLACE, (guchar *) cstring, strlen(cstring));
        
            mainEnv->ReleaseStringUTFChars((jstring)data, cstring);
            is_data_set = TRUE;
        } else if (mainEnv->IsInstanceOf(data, jByteBufferCls)) {
            jbyteArray byteArray = (jbyteArray)mainEnv->CallObjectMethod(data, jByteBufferArray);
            if (!EXCEPTION_OCCURED(mainEnv)) {
                jbyte* raw = mainEnv->GetByteArrayElements(byteArray, NULL);
                jsize nraw = mainEnv->GetArrayLength(byteArray);

                gdk_property_change(requestor, property, target,
                        8, GDK_PROP_MODE_REPLACE, (guchar *) raw, nraw);

                mainEnv->ReleaseByteArrayElements(byteArray, raw, JNI_ABORT);
                is_data_set = TRUE;
            }
        }
    }
    
    g_free(target_name);
    return is_data_set;
}
static PyObject * py_set_strut(PyObject * self, PyObject * args) {
	PyObject * py_gdk_window;
	PyObject * py_list;
	if (!PyArg_ParseTuple(args, "OO", &py_gdk_window, &py_list))
		return NULL;

	if(!pygobject_check(py_gdk_window, pygobject_lookup_class(GDK_TYPE_WINDOW))) {
		return NULL;
	}

	if(!PyList_Check(py_list)) {
		return NULL;
	}

	if (PyList_Size(py_list) == 4) {
		/* if _net_wm_strut */
		long strut[4];
		for (int i = 0; i < 4; ++i) {
			PyObject * v = PyList_GetItem(py_list, i);
			if (PyLong_Check(v)) {
				strut[i] = PyLong_AsLong(v);
			} else {
				return NULL;
			}
		}

		GdkAtom cardinal = gdk_atom_intern("CARDINAL", FALSE);
		GdkAtom _net_wm_strut = gdk_atom_intern("_NET_WM_STRUT", FALSE);

		gdk_property_change(GDK_WINDOW(pygobject_get(py_gdk_window)),
				_net_wm_strut, cardinal, 32, GDK_PROP_MODE_REPLACE,
				(guchar*) strut, 4);
	} else if (PyList_Size(py_list) == 12) {
		/* if _net_wm_strut_partial */

		long strut_partial[12];
		for (int i = 0; i < 12; ++i) {
			PyObject * v = PyList_GetItem(py_list, i);
			if (PyLong_Check(v)) {
				strut_partial[i] = PyLong_AsLong(v);
			} else {
				return NULL;
			}
		}

		GdkAtom cardinal = gdk_atom_intern("CARDINAL", FALSE);
		GdkAtom _net_wm_strut_partial = gdk_atom_intern("_NET_WM_STRUT_PARTIAL", FALSE);

		gdk_property_change(GDK_WINDOW(pygobject_get(py_gdk_window)),
				_net_wm_strut_partial, cardinal, 32, GDK_PROP_MODE_REPLACE,
				(guchar*) strut_partial, 12);
	} else {
		/* else error */
		return NULL;
	}

	Py_RETURN_NONE;
}
示例#4
0
static void
gst_editor_palette_set_property (GObject * object, guint prop_id,
    const GValue * value, GParamSpec * pspec)
{
  GdkAtom atoms[2] = { GDK_NONE, GDK_NONE };
  GdkWindow *window;
  GstEditorPalette *palette = GST_EDITOR_PALETTE (object);

  switch (prop_id) {
    case PROP_CANVAS:
      palette->canvas = (GstEditorCanvas *) g_value_get_object (value);
      if (GTK_IS_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (palette->
                      canvas)))) {
        gtk_window_set_transient_for (GTK_WINDOW (palette->window),
            GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (palette->
                        canvas))));

        /* we are assumed to be realized at this point.. */
        window = gtk_widget_get_window (palette->window);

        atoms[0] = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_UTILITY", FALSE);
        gdk_property_change (window,
            gdk_atom_intern ("_NET_WM_WINDOW_TYPE", FALSE),
            gdk_atom_intern ("ATOM", FALSE), 32,
            GDK_PROP_MODE_REPLACE, (guchar *) atoms, 1);
      }

      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
static void
attach_jobject (GdkWindow *window, jobject *obj)
{
  GdkAtom addr_atom = gdk_atom_intern ("_GNU_GTKAWT_ADDR", FALSE);
  GdkAtom type_atom = gdk_atom_intern ("CARDINAL", FALSE);

  gdk_window_set_events (window, 
			 gdk_window_get_events (window)
			 | GDK_POINTER_MOTION_MASK
			 | GDK_BUTTON_MOTION_MASK
			 | GDK_BUTTON_PRESS_MASK
			 | GDK_BUTTON_RELEASE_MASK
			 | GDK_KEY_PRESS_MASK
			 | GDK_KEY_RELEASE_MASK
			 | GDK_ENTER_NOTIFY_MASK
			 | GDK_LEAVE_NOTIFY_MASK
			 | GDK_STRUCTURE_MASK
			 | GDK_KEY_PRESS_MASK
			 | GDK_FOCUS_CHANGE_MASK);

  //  g_print("storing obj %p property on window %p\n", obj, window);
  gdk_property_change (window,
		       addr_atom,
		       type_atom,
		       8,
		       GDK_PROP_MODE_REPLACE,
		       (guchar *)obj,
		       sizeof (jobject));
}
示例#6
0
static void setXProperty(GtkWidget* window, const gchar *propertyName, const gchar *propertyValue)
{
    GdkAtom property = gdk_atom_intern_static_string(propertyName);
    gdk_property_change(gtk_widget_get_window(window), property,
        (GdkAtom)XA_STRING, 8, GDK_PROP_MODE_REPLACE,
        (const guchar *)propertyValue, strlen(propertyValue));
}
static gboolean
drag_begin (GtkWidget *widget, GdkDragContext *context, SeahorseKeyManagerStore *skstore)
{
	GtkTreeView *view = GTK_TREE_VIEW (widget);
	GdkWindow *source_window;

	g_debug ("drag_begin -->");

	g_free (skstore->priv->drag_destination);
	skstore->priv->drag_destination = NULL;

	g_clear_error (&skstore->priv->drag_error);

	g_list_free (skstore->priv->drag_objects);
	skstore->priv->drag_objects = seahorse_key_manager_store_get_selected_objects (view);

	if (skstore->priv->drag_objects) {
		source_window = gdk_drag_context_get_source_window (context);
		gdk_property_change (source_window, XDS_ATOM, TEXT_ATOM,
		                     8, GDK_PROP_MODE_REPLACE, (guchar*)XDS_FILENAME,
		                     strlen (XDS_FILENAME));
	}

	g_debug ("drag_begin <--");
	return skstore->priv->drag_objects ? TRUE : FALSE;
}
示例#8
0
文件: ml_gdk.c 项目: CRogers/obc
CAMLprim value ml_gdk_property_change (value window, value property, value type,
                              value mode, value xdata)
{
    int format = Xdata_val (Field(xdata,0));
    value data = Field(xdata,1);
    int nelems = (format == 8 ? string_length (data) : Wosize_val(data));
    guchar *sdata;
    int i;
    switch (format) {
    case 16:
        sdata = calloc(nelems, sizeof(short)); 
        for (i=0; i<nelems; i++)
            ((gushort*)sdata)[i] = Int_val(Field(data,i));
        break;
    case 32:
        sdata = calloc(nelems, sizeof(long));
        for (i=0; i<nelems; i++)
            ((gulong*)sdata)[i] = Int32_val(Field(data,i)); 
        break;
    default:
        sdata = (guchar*)data;
    }
    gdk_property_change (GdkWindow_val(window), GdkAtom_val(property),
                         GdkAtom_val(type), format, Property_mode_val(mode),
                         sdata, nelems);
    if (format != 8) free(sdata);
    return Val_unit;
}
示例#9
0
static void
handle_count_xprop(PidginWindow *purplewin)
{
#ifndef _WIN32
	guint count;
	GtkWidget *window;
	GdkWindow *gdkwin;

	window = purplewin->window;
	g_return_if_fail(window != NULL);

	if (_PurpleUnseenCount == GDK_NONE) {
		_PurpleUnseenCount = gdk_atom_intern("_PIDGIN_UNSEEN_COUNT", FALSE);
	}

	if (_Cardinal == GDK_NONE) {
		_Cardinal = gdk_atom_intern("CARDINAL", FALSE);
	}

	count = count_messages(purplewin);
#if GTK_CHECK_VERSION(2,14,0)
	gdkwin = gtk_widget_get_window(window);
#else
	gdkwin = window->window;
#endif

	gdk_property_change(gdkwin, _PurpleUnseenCount, _Cardinal, 32,
	                    GDK_PROP_MODE_REPLACE, (guchar *) &count, 1);
#endif
}
示例#10
0
文件: callbacks.c 项目: linuxmint/pix
static gboolean
gth_file_list_drag_drop (GtkWidget      *widget,
			 GdkDragContext *context,
			 gint            x,
			 gint            y,
			 guint           time,
			 gpointer        user_data)
{
	GthBrowser *browser = user_data;
	int         filename_len;
	char       *filename;

	g_signal_stop_emission_by_name (widget, "drag-drop");

	if (gdk_property_get (gdk_drag_context_get_source_window (context),
			      XDND_ACTION_DIRECT_SAVE_ATOM,
			      TEXT_PLAIN_ATOM,
			      0,
			      1024,
			      FALSE,
			      NULL,
			      NULL,
			      &filename_len,
			      (guchar **) &filename)
	    && GTH_IS_FILE_SOURCE_VFS (gth_browser_get_location_source (browser)))
	{
		GFile *file;
		char  *uri;

		filename = g_realloc (filename, filename_len + 1);
		filename[filename_len] = '\0';

		file = _g_file_append_path (gth_browser_get_location (browser), filename);
		uri = g_file_get_uri (file);
		gdk_property_change (gdk_drag_context_get_source_window (context),
				     XDND_ACTION_DIRECT_SAVE_ATOM,
				     TEXT_PLAIN_ATOM,
				     8,
				     GDK_PROP_MODE_REPLACE,
				     (const guchar *) uri,
				     strlen (uri));

		g_free (uri);
		g_object_unref (file);
		g_free (filename);

		gtk_drag_get_data (widget,
		                   context,
		                   XDND_ACTION_DIRECT_SAVE_ATOM,
		                   time);
	}
	else
		gtk_drag_get_data (widget,
				   context,
				   URI_LIST_ATOM,
				   time);

	return TRUE;
}
示例#11
0
文件: window.c 项目: DeforaOS/Panel
/* panel_window_reset_strut */
static void _panel_window_reset_strut(PanelWindow * panel)
{
	GdkWindow * window;
	GdkAtom atom;
	GdkAtom cardinal;
	unsigned long strut[12];

#if GTK_CHECK_VERSION(2, 14, 0)
	window = gtk_widget_get_window(panel->window);
#else
	window = panel->window->window;
#endif
	memset(&strut, 0, sizeof(strut));
	/* FIXME check that this code is correct */
	switch(panel->position)
	{
		case PANEL_WINDOW_POSITION_TOP:
			strut[2] = panel->height;
			strut[8] = panel->root.x;
			strut[9] = panel->root.x + panel->root.width;
			break;
		case PANEL_WINDOW_POSITION_BOTTOM:
			strut[3] = panel->height;
			strut[10] = panel->root.x;
			strut[11] = panel->root.x + panel->root.width;
			break;
#if 0 /* FIXME implement */
		case PANEL_WINDOW_POSITION_LEFT:
		case PANEL_WINDOW_POSITION_RIGHT:
			break;
#endif
		case PANEL_WINDOW_POSITION_CENTER:
		case PANEL_WINDOW_POSITION_FLOATING:
		case PANEL_WINDOW_POSITION_MANAGED:
		case PANEL_WINDOW_POSITION_EMBEDDED:
			break;
	}
	cardinal = gdk_atom_intern("CARDINAL", FALSE);
	atom = gdk_atom_intern("_NET_WM_STRUT", FALSE);
	gdk_property_change(window, atom, cardinal, 32, GDK_PROP_MODE_REPLACE,
			(guchar *)strut, 4);
	atom = gdk_atom_intern("_NET_WM_STRUT_PARTIAL", FALSE);
	gdk_property_change(window, atom, cardinal, 32, GDK_PROP_MODE_REPLACE,
			(guchar *)strut, 12);
}
示例#12
0
void set_wmspec_dock_hint(GdkWindow *window)
{
    GdkAtom atom = gdk_atom_intern ("_NET_WM_WINDOW_TYPE_DOCK", FALSE);

    gdk_property_change (window,
                         gdk_atom_intern ("_NET_WM_WINDOW_TYPE", FALSE),
                         gdk_x11_xatom_to_atom (XA_ATOM), 32,
                         GDK_PROP_MODE_REPLACE, (guchar *) &atom, 1);
}
示例#13
0
void matenu_settings_set_by_atom (MatenuSettings* self, GdkAtom atom, const char* value) {
	g_return_if_fail (self != NULL);
	if (value != NULL) {
		GdkAtom type;
		type = gdk_atom_intern ("STRING", FALSE);
		gdk_property_change (self->priv->_window, atom, type, 8, GDK_PROP_MODE_REPLACE, value, ((gint) strlen (value)) + 1);
	} else {
		gdk_property_delete (self->priv->_window, atom);
	}
}
示例#14
0
static void
hildon_banner_realize                           (GtkWidget *widget)
{
    GdkWindow *gdkwin;
    GdkScreen *screen;
    GdkAtom atom;
    guint32 portrait = 1;
    const gchar *notification_type = "_HILDON_NOTIFICATION_TYPE_BANNER";
    HildonBannerPrivate *priv = HILDON_BANNER_GET_PRIVATE (widget);
    g_assert (priv);

    /* We let the parent to init widget->window before we need it */
    if (GTK_WIDGET_CLASS (hildon_banner_parent_class)->realize)
        GTK_WIDGET_CLASS (hildon_banner_parent_class)->realize (widget);

    /* We use special hint to turn the banner into information notification. */
    gdk_window_set_type_hint (widget->window, GDK_WINDOW_TYPE_HINT_NOTIFICATION);
    gtk_window_set_transient_for (GTK_WINDOW (widget), (GtkWindow *) priv->parent);

    gdkwin = widget->window;

    /* Set the _HILDON_NOTIFICATION_TYPE property so Matchbox places the window correctly */
    atom = gdk_atom_intern ("_HILDON_NOTIFICATION_TYPE", FALSE);
    gdk_property_change (gdkwin, atom, gdk_x11_xatom_to_atom (XA_STRING), 8, GDK_PROP_MODE_REPLACE,
                         (gpointer) notification_type, strlen (notification_type));

    /* HildonBanner supports portrait mode */
    atom = gdk_atom_intern ("_HILDON_PORTRAIT_MODE_SUPPORT", FALSE);
    gdk_property_change (gdkwin, atom, gdk_x11_xatom_to_atom (XA_CARDINAL), 32,
                         GDK_PROP_MODE_REPLACE, (gpointer) &portrait, 1);

    /* Manage override flag */
    if ((priv->require_override_dnd)&&(!priv->overrides_dnd)) {
      hildon_banner_set_override_flag (HILDON_BANNER (widget));
        priv->overrides_dnd = TRUE;
    }

    screen = gtk_widget_get_screen (widget);
    g_signal_connect (screen, "size-changed", G_CALLBACK (screen_size_changed), widget);
}
示例#15
0
static void
hildon_banner_set_override_flag                 (HildonBanner *banner)
{
    guint32 state = 1;

    gdk_property_change (GTK_WIDGET (banner)->window,
                         gdk_atom_intern_static_string ("_HILDON_DO_NOT_DISTURB_OVERRIDE"),
                         gdk_x11_xatom_to_atom (XA_INTEGER),
                         32,
                         GDK_PROP_MODE_REPLACE,
                         (const guchar*) &state,
                         1);
}
示例#16
0
static void update_struts(void)
/* Reserves screen space for the docked window.
   FIXME In Metacity it causes the window to be shoved outside of its own
         struts, which is especially devastating for top docking because this
         causes an infinite loop of events causing the struts to repeatedly
         scan down from the top of the screen. GOK and other applications
         somehow get around this but I can't figure out how. */
{
        static gulong struts[12];
        guint32 new2 = 0, new3 = 0, new9 = 0, new11 = 0;
        GdkAtom atom_strut, atom_strut_partial, cardinal;

        if (!window || !window->window || !window_struts)
                return;
        if (window_docked == WINDOW_DOCKED_TOP) {
                new2 = window_frame.y + window_frame.height;
                new9 = window_frame.width;
        } else if (window_docked == WINDOW_DOCKED_BOTTOM) {
                new3 = window_frame.height;
                new11 = window_frame.width;
        }
        if (new2 == struts[2] && new3 == struts[3] &&
            new9 == struts[9] && new11 == struts[11])
                return;
        trace("top=%d (%d) bottom=%d (%d)", new2, new9, new3, new11);
        struts[2] = new2;
        struts[3] = new3;
        struts[9] = new9;
        struts[11] = new11;
        atom_strut = gdk_atom_intern("_NET_WM_STRUT", FALSE),
        atom_strut_partial = gdk_atom_intern("_NET_WM_STRUT_PARTIAL", FALSE);
        cardinal = gdk_atom_intern("CARDINAL", FALSE);
        gdk_property_change(GDK_WINDOW(window->window), atom_strut, cardinal,
                            32, GDK_PROP_MODE_REPLACE, (guchar*)&struts, 4);
        gdk_property_change(GDK_WINDOW(window->window), atom_strut_partial,
                            cardinal, 32, GDK_PROP_MODE_REPLACE,
                            (guchar*)&struts, 12);
}
PageFlipPanel::PageFlipPanel()
    : up_button("U"), down_button("D")
{
    int width = 50;

    up_button.signal_clicked().connect(
        sigc::mem_fun(*this, &PageFlipPanel::up_button_pressed));
    down_button.signal_clicked().connect(
        sigc::mem_fun(*this, &PageFlipPanel::down_button_pressed));


    vbox.pack_start(up_button, Gtk::PACK_EXPAND_WIDGET);
    vbox.pack_start(down_button);
    add(vbox);
    up_button.show();
    down_button.show();
    vbox.show();

    set_default_size(width, Gdk::screen_height());
    move(Gdk::screen_width()-width, 0);
    set_type_hint(Gdk::WINDOW_TYPE_HINT_DOCK);
    show();

    gulong val[12];
    val[0] = 0;
    val[1] = width;
    val[2] = 0;
    val[3] = 0;
    val[4] = 0;
    val[5] = 0;
    val[6] = 0;
    val[7] = 200;
    val[8] = 0;
    val[9] = 0;
    val[10] = 0;
    val[11] = 0;

    GtkWindow* gtkWindow = gobj();

    gdk_property_change(
        GTK_WIDGET(gtkWindow)->window,
        gdk_atom_intern("_NET_WM_STRUT_PARTIAL", FALSE),
        gdk_atom_intern ("CARDINAL", FALSE),
        32,
        GDK_PROP_MODE_REPLACE,
        (unsigned char *)val, 12);


}
static gboolean dnd_source_set_utf8_string(GdkWindow *requestor, GdkAtom property)
{
    jstring string = (jstring)dnd_source_get_data("text/plain");
    if (!string) {
        return FALSE;
    }

    const char *cstring = mainEnv->GetStringUTFChars(string, NULL);
    gint size = strlen(cstring);
    
    gdk_property_change(requestor, property, GDK_SELECTION_TYPE_STRING,
            8, GDK_PROP_MODE_REPLACE, (guchar *)cstring, size);
    
    mainEnv->ReleaseStringUTFChars(string, cstring);
    return TRUE;
}
示例#19
0
static void realized_cb(GtkWidget *widget, gpointer userdata)
{
    BudgiePanel *self;
    GdkScreen *screen;
    int height, x, y;
    GtkAllocation alloc;
    GdkWindow *window;
    long vals[4];
    GdkAtom atom;

    self = BUDGIE_PANEL(userdata);
    screen = gtk_widget_get_screen(widget);
    height = gdk_screen_get_height(screen);

    gtk_widget_get_allocation(widget, &alloc);
    x = 0;

    /* Place at bottom or top */
    if (self->position == PANEL_BOTTOM) {
        y = (height - alloc.height)+1;
    } else {
        y = 0;
    }

    gtk_window_move(GTK_WINDOW(self), x, y);

    vals[0] = 0;
    vals[1] = 0;
    if (self->position == PANEL_BOTTOM) {
        vals[2] = 0;
        vals[3] = alloc.height;
    } else {
        vals[2] = alloc.height;
        vals[3] = 0;
    }

    /* Reserve space for the bar with the window manager */
    atom = gdk_atom_intern ("_NET_WM_STRUT", FALSE);
    window = gtk_widget_get_window(GTK_WIDGET(widget));
    if (window) {
        gdk_property_change (window, atom, gdk_atom_intern("CARDINAL", FALSE),
                             32, GDK_PROP_MODE_REPLACE, (guchar *)vals, 4);
    }

    gtk_widget_queue_draw(GTK_WIDGET(self));
}
static gboolean dnd_source_set_uri_list(GdkWindow *requestor, GdkAtom property)
{
    const gchar* url = NULL;
    jstring jurl = NULL;

    jobjectArray files_array = NULL;
    gsize files_cnt = 0;

    if (jurl = (jstring) dnd_source_get_data("text/uri-list")) {
        url = mainEnv->GetStringUTFChars(jurl, NULL);
    }

    if (files_array = (jobjectArray) dnd_source_get_data("application/x-java-file-list")) {
        files_cnt = mainEnv->GetArrayLength(files_array);
    }
    if (!url && !files_cnt) {
        return FALSE;
    }

    GString* res = g_string_new (NULL); //http://www.ietf.org/rfc/rfc2483.txt 

    if (files_cnt > 0) {
        for (gsize i = 0; i < files_cnt; ++i) {
            jstring string = (jstring) mainEnv->GetObjectArrayElement(files_array, i);
            const gchar* file = mainEnv->GetStringUTFChars(string, NULL);
            gchar* uri = g_filename_to_uri(file, NULL, NULL);

            g_string_append(res, uri);
            g_string_append(res, URI_LIST_LINE_BREAK);

            g_free(uri);
            mainEnv->ReleaseStringUTFChars(string, file);
        }
    }
    if (url) {
        g_string_append(res, url);
        g_string_append(res, URI_LIST_LINE_BREAK);
        mainEnv->ReleaseStringUTFChars(jurl, url);
    }

    gdk_property_change(requestor, property, GDK_SELECTION_TYPE_STRING,
            8, GDK_PROP_MODE_REPLACE, (guchar *) res->str, res->len);

    g_string_free(res, TRUE);
    return TRUE;
}
static void
task_manager_dialog_hide (GtkWidget *dialog,gpointer nul)
{
  TaskManagerDialogPrivate * priv = GET_PRIVATE (dialog);

  if (priv->data)
  {
    g_free (priv->data);
    priv->data = g_new0 (long,1);
    priv->data[0] = 0;
    gdk_property_change ((GTK_WIDGET(dialog))->window, 
			priv->kde_a,
			priv->kde_a,
			32, 
			GDK_PROP_MODE_REPLACE, 
			(guchar*) priv->data,
			1);
  }  
static void
set_desktop_window_id (AthenaDesktopWindow *window,
		       GdkWindow             *gdkwindow)
{
	/* Tuck the desktop windows xid in the root to indicate we own the desktop.
	 */
	Window window_xid;
	GdkWindow *root_window;

	root_window = gdk_screen_get_root_window (
				gtk_window_get_screen (GTK_WINDOW (window)));

	window_xid = GDK_WINDOW_XID (gdkwindow);

	gdk_property_change (root_window,
			     gdk_atom_intern ("ATHENA_DESKTOP_WINDOW_ID", FALSE),
			     gdk_x11_xatom_to_atom (XA_WINDOW), 32,
			     GDK_PROP_MODE_REPLACE, (guchar *) &window_xid, 1);
}
示例#23
0
文件: wins.c 项目: UIKit0/picogui
void
wins_set_icon (GtkWidget *win)
{
#ifdef USE_XLIB
	GdkAtom icon_atom;
	glong data[2];

	gtk_widget_realize (win);

	data[0] = GDK_WINDOW_XWINDOW (pix_xchat_mini);
	data[1] = GDK_WINDOW_XWINDOW (mask_xchat_mini);
	icon_atom = gdk_atom_intern ("KWM_WIN_ICON", FALSE);
	gdk_property_change (win->window, icon_atom, icon_atom,
								32, GDK_PROP_MODE_REPLACE, (guchar *) data, 2);

	gdk_window_set_icon (win->window, NULL, pix_xchat, mask_xchat);
	gdk_window_set_icon_name (win->window, PACKAGE);
#endif
}
示例#24
0
static void
set_direct_save_uri (GtkWidget *widget, GdkDragContext *context, NemoDragInfo *drag_info, int x, int y)
{
	GFile *base, *child;
	char *filename, *drop_target;
	gchar *uri;
	
	drag_info->got_drop_data_type = TRUE;
	drag_info->data_type = NEMO_ICON_DND_XDNDDIRECTSAVE;
	
	uri = NULL;
	
	filename = get_direct_save_filename (context);
	drop_target = nemo_icon_container_find_drop_target (NEMO_ICON_CONTAINER (widget), 
								context, x, y, NULL, TRUE);
	
	if (drop_target && eel_uri_is_trash (drop_target)) {
		g_free (drop_target);
		drop_target = NULL; /* Cannot save to trash ...*/
	}
	
	if (filename != NULL && drop_target != NULL) {
		/* Resolve relative path */
		base = g_file_new_for_uri (drop_target);
		child = g_file_get_child (base, filename);
		uri = g_file_get_uri (child);
		g_object_unref (base);
		g_object_unref (child);
		
		/* Change the uri property */
		gdk_property_change (gdk_drag_context_get_source_window (context),
				     gdk_atom_intern (NEMO_ICON_DND_XDNDDIRECTSAVE_TYPE, FALSE),
				     gdk_atom_intern ("text/plain", FALSE), 8,
				     GDK_PROP_MODE_REPLACE, (const guchar *) uri,
				     strlen (uri));
		
		drag_info->direct_save_uri = uri;
	} 
	
	g_free (filename);
	g_free (drop_target);
}
static gboolean
set_direct_save_uri (NautilusTreeViewDragDest *dest,
                     GdkDragContext *context,
                     int x, int y)
{
    GFile *base, *child;
    char *drop_uri;
    char *filename, *uri;

    g_assert (dest->details->direct_save_uri == NULL);

    uri = NULL;

    drop_uri = get_drop_target_uri_at_pos (dest, x, y);
    if (drop_uri != NULL) {
        filename = get_direct_save_filename (context);
        if (filename != NULL) {
            /* Resolve relative path */
            base = g_file_new_for_uri (drop_uri);
            child = g_file_get_child (base, filename);
            uri = g_file_get_uri (child);

            g_object_unref (base);
            g_object_unref (child);

            /* Change the property */
            gdk_property_change (gdk_drag_context_get_source_window (context),
                                 gdk_atom_intern (NAUTILUS_ICON_DND_XDNDDIRECTSAVE_TYPE, FALSE),
                                 gdk_atom_intern ("text/plain", FALSE), 8,
                                 GDK_PROP_MODE_REPLACE, (const guchar *) uri,
                                 strlen (uri));

            dest->details->direct_save_uri = uri;
        } else {
            DEBUG ("Invalid filename provided by XDS drag site");
        }
    } else {
        DEBUG ("Could not retrieve XDS drop destination");
    }

    return uri != NULL;
}
static gboolean dnd_source_set_string(GdkWindow *requestor, GdkAtom property)
{
    jstring string = (jstring)dnd_source_get_data("text/plain");
    if (!string) {
        return FALSE;
    }
    
    gboolean is_data_set = FALSE;
    const char *cstring = mainEnv->GetStringUTFChars(string, NULL);
    gchar *res_str = g_convert((gchar *)cstring, -1, "ISO-8859-1", "UTF-8", NULL, NULL, NULL);
    
    if (res_str) {
        gdk_property_change(requestor, property, GDK_SELECTION_TYPE_STRING,
                8, GDK_PROP_MODE_REPLACE, (guchar *)res_str, strlen(res_str));
        g_free(res_str);
        is_data_set = TRUE;
    }
    
    mainEnv->ReleaseStringUTFChars(string, cstring);
    return is_data_set;
}
示例#27
0
gchar *
gedit_utils_set_direct_save_filename (GdkDragContext *context)
{
	gchar *uri;
	gchar *filename;

	uri = NULL;
	filename = get_direct_save_filename (context);

	if (filename != NULL)
	{
		gchar *tempdir;
		gchar *path;

		tempdir = g_dir_make_tmp ("gedit-drop-XXXXXX", NULL);
		if (tempdir == NULL)
		{
			tempdir = g_strdup (g_get_tmp_dir ());
		}

		path = g_build_filename (tempdir,
					filename,
					NULL);

		uri = g_filename_to_uri (path, NULL, NULL);

		/* Change the property */
		gdk_property_change (gdk_drag_context_get_source_window (context),
				     gdk_atom_intern ("XdndDirectSave0", FALSE),
				     gdk_atom_intern ("text/plain", FALSE), 8,
				     GDK_PROP_MODE_REPLACE, (const guchar *) uri,
				     strlen (uri));

		g_free (tempdir);
		g_free (path);
		g_free (filename);
	}

	return uri;
}
static void
OssoSetWindowOrientation(bool aPortrait)
{
  // If we locked the screen, ignore any orientation changes
  bool lockScreen = false;
  nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
  if (prefs)
    prefs->GetBoolPref("toolkit.screen.lock", &lockScreen);

  if (lockScreen)
    return;

  // Tell Hildon desktop to force our window to be either portrait or landscape,
  // depending on the current rotation
  // NOTE: We only update the most recent top-level window so this is only
  //       suitable for apps with only one window.
  nsCOMPtr<nsIDOMWindow> window;
  GetMostRecentWindow(EmptyString().get(), getter_AddRefs(window));
  GtkWidget* widget = WidgetForDOMWindow(window);
  if (widget && widget->window) {
    GdkWindow *gdk = widget->window;
    GdkAtom request = gdk_atom_intern("_HILDON_PORTRAIT_MODE_REQUEST", FALSE);

    if (aPortrait) {
      gulong portrait_set = 1;
      gdk_property_change(gdk, request, gdk_x11_xatom_to_atom(XA_CARDINAL),
                          32, GDK_PROP_MODE_REPLACE, (const guchar *) &portrait_set, 1);
    }
    else {
      gdk_property_delete(gdk, request);
    }
  }

  // Update the system info property
  nsCOMPtr<nsIWritablePropertyBag2> info = do_GetService("@mozilla.org/system-info;1");
  if (info) {
    info->SetPropertyAsAString(NS_LITERAL_STRING("screen-orientation"),
                               aPortrait ? NS_LITERAL_STRING("portrait") : NS_LITERAL_STRING("landscape"));
  }
}
示例#29
0
static VALUE
rg_m_change(int argc, VALUE *argv, VALUE self)
{
    int        fmt, len;
    void*      dat;
    GdkAtom    ntype;
    VALUE win, property, type, size= Qnil, mode, src;

    if(6 == argc)
        rb_scan_args(argc, argv, "60", &win, &property, &type, &size, &mode, &src);
    else
        rb_scan_args(argc, argv, "50", &win, &property, &type, &mode, &src);

    rbgtk_atom2selectiondata(type, size, src, &ntype, &dat, &fmt, &len);

    gdk_property_change(GDK_WINDOW(RVAL2GOBJ(win)), RVAL2ATOM(property),
                        ntype, fmt, RVAL2GENUM(mode, GDK_TYPE_PROP_MODE), dat, len);

    rbgtk_atom2selectiondata_free(ntype, dat);

    return self;
}
示例#30
0
文件: desktop.c 项目: bitptr/argonaut
/*
 * Make the widget a root window. Set its class, set the _NET_WM_WINDOW_TYPE to
 * _NET_WM_WINDOW_TYPE_DESKTOP, and set the is_desktop_window property to true.
 */
static void
desktopize(GtkWidget *root)
{
	GdkAtom		 atom;
	GdkWindow	*gdk_window;

	atom = gdk_atom_intern("_NET_WM_WINDOW_TYPE_DESKTOP", FALSE);

	gtk_window_set_wmclass(GTK_WINDOW(root), "desktop_window", "Argonaut");

	gtk_widget_realize(root);

	if ((gdk_window = gtk_widget_get_window(root)) == NULL)
		errx(1, "gtk_widget_get_window: cannot get window");

	gdk_property_change(gdk_window,
	    gdk_atom_intern("_NET_WM_WINDOW_TYPE", FALSE),
	    gdk_x11_xatom_to_atom(XA_ATOM), 32,
	    GDK_PROP_MODE_REPLACE, (guchar *)&atom, 1);

	g_object_set_data(G_OBJECT(root), "is_desktop_window", 
	    GINT_TO_POINTER(1));
}