How to use Gdk::Property.change?


#1

Hi,
I want to do something like Gdk::Property.change(self, Gdk::Atom.intern('_NET_WM_STRUT', false), Gdk::Atom.intern('CARDINAL', false), Gdk::Property::MODE_REPLACE, [0, 162, 0, 1024]). It failed
with “no supported type. (ArgumentError)”.
I do not know if I use it right, since no document for this
function…


竹密岂妨流水过
山高哪阻野云飞


#2

So no one knows? I am shocked that Gdk::Property.change(self.window, Gdk::Atom.intern('_NET_WM_STRUT', false), Gdk::Atom.intern('CARDINAL', false), 32, Gdk::Property::MODE_REPLACE, [0, 0, 162, 0].pack('LLLL'))
does not work.
This job is pretty easy in pygtk, why not in ruby-gtk…

On Tue, Mar 10, 2009 at 9:30 AM, Magicloud M.
removed_email_address@domain.invalid wrote:


竹密岂妨流水过
山高哪阻野云飞


#3

Fine, I do it myself. After looking into the c source and comparing
with pygtk. I made a modification.
diff gtk/src/rbgtkselectiondata.c gtk/src/rbgtkselectiondata.c.bak
45c45
< len = (RSTRING_LEN(src) * sizeof(char) * 8 / fmt);

len = (RSTRING_LEN(src) * sizeof(char) / fmt);

On Thu, Mar 12, 2009 at 3:25 PM, Magicloud M.
removed_email_address@domain.invalid wrote:

Gdk::Atom.intern(’_NET_WM_STRUT’, false), Gdk::Atom.intern(‘CARDINAL’,


竹密岂妨流水过
山高哪阻野云飞


竹密岂妨流水过
山高哪阻野云飞


#4

Hi,

In removed_email_address@domain.invalid
“Re: [ruby-gnome2-devel-en] How to use Gdk::Property.change?” on Thu,
12 Mar 2009 15:48:20 +0800,
Magicloud M. removed_email_address@domain.invalid wrote:

Fine, I do it myself. After looking into the c source and comparing
with pygtk. I made a modification.
diff gtk/src/rbgtkselectiondata.c gtk/src/rbgtkselectiondata.c.bak
45c45
< len = (RSTRING_LEN(src) * sizeof(char) * 8 / fmt);

len = (RSTRING_LEN(src) * sizeof(char) / fmt);

I want to apply your patch with a test.
Do you have a small script that shows your problem
can be fixed your patch?
If you provide a small script, I’ll write a test based on
it.

Thanks,

kou


#5

This is a dockWindow I made, almost the same code could run in C or
pygtk, not in original ruby-gtk2. After I fixed it, this works.
But I am not sure my patch work with format 8/16.

1 class DockWindow < Gtk::Window
2 attr_reader(:width, :height, :edge)
3 def initialize(edge)
4 super()
5 @edge = edge
6 self.decorated = false
7 self.colormap = self.screen.rgba_colormap
8 self.type_hint = Gdk::Window::TYPE_HINT_DOCK
9 self.signal_connect(‘realize’) do
10 self.window.override_redirect = true
11 end
12 self.signal_connect(‘configure-event’) do |widget, event|
13 @width = event.width
14 @height = event.height
15 case @edge
16 when :left
17 gap = [@width, 0, 0, 0]
18 self.move(0, 0)
19 when :bottom
20 gap = [0, 0, 0, @height]
21 self.move(0, self.window.screen.height - @height)
22 when :right
23 gap = [0, @width, 0, 0]
24 self.move(self.window.screen.width - @width, 0)
25 when :top
26 gap = [0, 0, @height, 0]
27 self.move(0, 0)
28 end
29 Gdk::Property.change(self.window,
Gdk::Atom.intern(’_NET_WM_STRUT’, false), Gdk::Atom.intern(‘CARDINAL’,
false), 32, Gdk::Property::MODE_REPLACE, gap.pack(‘LLLL’))
30 false
31 end
32 self.signal_connect_after(‘destroy’) do
33 Gtk.main_quit
34 end
35 end
36 end

On Sat, Mar 14, 2009 at 10:05 AM, Kouhei S. removed_email_address@domain.invalid wrote:

< Â Â len = (RSTRING_LEN(src) * sizeof(char) * 8 / fmt);
Thanks,
ruby-gnome2-devel-en mailing list
removed_email_address@domain.invalid
https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en


竹密岂妨流水过
山高哪阻野云飞