swat 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,87 @@
1
+ /* eggaccelerators.h
2
+ * Copyright (C) 2002 Red Hat, Inc.
3
+ * Developed by Havoc Pennington
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Library General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Library General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Library General Public
16
+ * License along with this library; if not, write to the
17
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
+ * Boston, MA 02111-1307, USA.
19
+ */
20
+
21
+ #ifndef __EGG_ACCELERATORS_H__
22
+ #define __EGG_ACCELERATORS_H__
23
+
24
+ #include <gtk/gtkaccelgroup.h>
25
+ #include <gdk/gdk.h>
26
+
27
+ G_BEGIN_DECLS
28
+
29
+ /* Where a value is also in GdkModifierType we coincide,
30
+ * otherwise we don't overlap.
31
+ */
32
+ typedef enum
33
+ {
34
+ EGG_VIRTUAL_SHIFT_MASK = 1 << 0,
35
+ EGG_VIRTUAL_LOCK_MASK = 1 << 1,
36
+ EGG_VIRTUAL_CONTROL_MASK = 1 << 2,
37
+
38
+ EGG_VIRTUAL_ALT_MASK = 1 << 3, /* fixed as Mod1 */
39
+
40
+ EGG_VIRTUAL_MOD2_MASK = 1 << 4,
41
+ EGG_VIRTUAL_MOD3_MASK = 1 << 5,
42
+ EGG_VIRTUAL_MOD4_MASK = 1 << 6,
43
+ EGG_VIRTUAL_MOD5_MASK = 1 << 7,
44
+
45
+ #if 0
46
+ GDK_BUTTON1_MASK = 1 << 8,
47
+ GDK_BUTTON2_MASK = 1 << 9,
48
+ GDK_BUTTON3_MASK = 1 << 10,
49
+ GDK_BUTTON4_MASK = 1 << 11,
50
+ GDK_BUTTON5_MASK = 1 << 12,
51
+ /* 13, 14 are used by Xkb for the keyboard group */
52
+ #endif
53
+
54
+ EGG_VIRTUAL_META_MASK = 1 << 24,
55
+ EGG_VIRTUAL_SUPER_MASK = 1 << 25,
56
+ EGG_VIRTUAL_HYPER_MASK = 1 << 26,
57
+ EGG_VIRTUAL_MODE_SWITCH_MASK = 1 << 27,
58
+ EGG_VIRTUAL_NUM_LOCK_MASK = 1 << 28,
59
+ EGG_VIRTUAL_SCROLL_LOCK_MASK = 1 << 29,
60
+
61
+ /* Also in GdkModifierType */
62
+ EGG_VIRTUAL_RELEASE_MASK = 1 << 30,
63
+
64
+ /* 28-31 24-27 20-23 16-19 12-15 8-11 4-7 0-3
65
+ * 7 f 0 0 0 0 f f
66
+ */
67
+ EGG_VIRTUAL_MODIFIER_MASK = 0x7f0000ff
68
+
69
+ } EggVirtualModifierType;
70
+
71
+ gboolean egg_accelerator_parse_virtual (const gchar *accelerator,
72
+ guint *accelerator_key,
73
+ EggVirtualModifierType *accelerator_mods);
74
+ void egg_keymap_resolve_virtual_modifiers (GdkKeymap *keymap,
75
+ EggVirtualModifierType virtual_mods,
76
+ GdkModifierType *concrete_mods);
77
+ void egg_keymap_virtualize_modifiers (GdkKeymap *keymap,
78
+ GdkModifierType concrete_mods,
79
+ EggVirtualModifierType *virtual_mods);
80
+
81
+ gchar* egg_virtual_accelerator_name (guint accelerator_key,
82
+ EggVirtualModifierType accelerator_mods);
83
+
84
+ G_END_DECLS
85
+
86
+
87
+ #endif /* __EGG_ACCELERATORS_H__ */
Binary file
@@ -0,0 +1,84 @@
1
+ require "English"
2
+ require "mkmf"
3
+ require "ftools"
4
+ require "rbconfig"
5
+ =begin
6
+ extconf.rb for Ruby/GTK extention library
7
+ =end
8
+
9
+ PACKAGE_NAME = "gtk2"
10
+ PKG_CONFIG_ID = "gtk+-2.0"
11
+
12
+ require 'mkmf-gnome2'
13
+
14
+ #
15
+ # detect GTK+ configurations
16
+ #
17
+
18
+ PKGConfig.have_package('gthread-2.0')
19
+ PKGConfig.have_package(PKG_CONFIG_ID) or exit 1
20
+ setup_win32(PACKAGE_NAME)
21
+
22
+ STDOUT.print("checking for target... ")
23
+ STDOUT.flush
24
+ target = PKGConfig.variable(PKG_CONFIG_ID, "target")
25
+ $defs << "-DRUBY_GTK2_TARGET=\\\"#{target}\\\""
26
+ STDOUT.print(target, "\n")
27
+
28
+ #
29
+ # detect location of GDK include files
30
+ #
31
+ gdkincl = nil
32
+ tmpincl = $CFLAGS.gsub(/-D\w+/, '').split(/-I/) + ['/usr/include']
33
+ tmpincl.each do |i|
34
+ i.strip!
35
+
36
+ if FileTest.exist?(i + "/gdk/gdkkeysyms.h")
37
+ gdkincl = i + "/gdk"
38
+ break
39
+ end
40
+ end
41
+ raise "can't find gdkkeysyms.h" if gdkincl.nil?
42
+
43
+ have_func('gtk_plug_get_type')
44
+ have_func('gtk_socket_get_type')
45
+ have_func('pango_render_part_get_type')
46
+
47
+ if target=="x11"
48
+ have_func("XReadBitmapFileData")
49
+ have_header('X11/Xlib.h')
50
+ have_func("XGetErrorText")
51
+ end
52
+
53
+ PKGConfig.have_package('gtk+-unix-print-2.0')
54
+
55
+ have_func('gtk_print_unix_dialog_get_type')
56
+ have_func('gtk_print_job_get_type')
57
+ have_func('gtk_printer_get_type')
58
+ have_func('gtk_page_setup_unix_get_type')
59
+
60
+ PKGConfig.have_package('cairo')
61
+ if have_header('rb_cairo.h')
62
+ if /mingw|cygwin|mswin32/ =~ RUBY_PLATFORM
63
+ unless ENV["CAIRO_PATH"]
64
+ puts "Error! Set CAIRO_PATH."
65
+ exit 1
66
+ end
67
+ add_depend_package("cairo", "packages/cairo/ext", ENV["CAIRO_PATH"])
68
+ $defs << "-DRUBY_CAIRO_PLATFORM_WIN32"
69
+ end
70
+ end
71
+
72
+
73
+ #
74
+ # create Makefiles
75
+ #
76
+
77
+ add_distcleanfile("rbgdkkeysyms.h")
78
+ add_distcleanfile("rbgtkinits.c")
79
+
80
+
81
+ $defs.delete("-DRUBY_GTK2_COMPILATION")
82
+
83
+ create_makefile("keybinder")
84
+
@@ -0,0 +1,49 @@
1
+ #include "ruby.h"
2
+ #include "tomboykeybinder.h"
3
+
4
+ static VALUE key_callback_hash;
5
+ static VALUE key_binder_class;
6
+
7
+ // the callback, that gets invoked when key is pressed
8
+ void handler_c_func(char *keystring, gpointer user_data)
9
+ {
10
+ VALUE rb_keystring = rb_str_new2(keystring);
11
+
12
+ VALUE callback_func = rb_hash_aref(key_callback_hash,rb_keystring);
13
+
14
+ //rb_funcall(key_binder_class,rb_intern(StringValuePtr(callback_func)),0);
15
+ rb_funcall(callback_func,rb_intern("call"),0);
16
+ }
17
+
18
+ // an instance method, which gets invoked when you bind the key
19
+ static VALUE rb_tomboy_binder(VALUE self,VALUE key_string, VALUE callback_string)
20
+ {
21
+ /* VALUE key_callback_hash; */
22
+ /* key_callback_hash = rb_iv_get(self,"@callback_hash_shit"); */
23
+ /* if(NIL_P(key_callback_hash)) */
24
+ /* rb_raise(rb_eTypeError, "not valid value"); */
25
+
26
+ rb_hash_aset(key_callback_hash,key_string,callback_string);
27
+
28
+ char *input_key_string = StringValuePtr(key_string);
29
+
30
+ tomboy_keybinder_bind(input_key_string,&handler_c_func,NULL);
31
+ return Qnil;
32
+ }
33
+
34
+
35
+ static VALUE rb_initialize_keybinder(VALUE self)
36
+ {
37
+ key_callback_hash = rb_hash_new();
38
+ rb_iv_set(self,"@callback_hash_shit",key_callback_hash);
39
+ rb_iv_set(self,"@valid",Qtrue);
40
+ tomboy_keybinder_init();
41
+ return self;
42
+ }
43
+
44
+
45
+ void Init_keybinder() {
46
+ key_binder_class = rb_define_class("KeyBinder",rb_cObject);
47
+ rb_define_method(key_binder_class,"initialize",rb_initialize_keybinder,0);
48
+ rb_define_method(key_binder_class,"bindkey",rb_tomboy_binder,2);
49
+ }
Binary file
Binary file
@@ -0,0 +1,286 @@
1
+ #
2
+ # mkmf-gnome2.rb
3
+ #
4
+ # Extended mkmf for Ruby-GNOME2 and Ruby/GLib based libraries.
5
+ #
6
+ # Copyright(C) 2003-2005 Ruby-GNOME2 Project.
7
+ #
8
+ # This program is licenced under the same
9
+ # license of Ruby-GNOME2.
10
+ #
11
+
12
+ require 'mkmf'
13
+ require 'pkg-config'
14
+ require 'glib-mkenums'
15
+
16
+ unless defined?(macro_defined?)
17
+ def macro_defined?(macro, src, opt="")
18
+ try_cpp(src + <<EOP, opt)
19
+ #ifndef #{macro}
20
+ # error
21
+ #endif
22
+ EOP
23
+ end
24
+ end
25
+
26
+
27
+ STDOUT.print("checking for GCC... ")
28
+ STDOUT.flush
29
+ if macro_defined?("__GNUC__", "")
30
+ STDOUT.print "yes\n"
31
+ $CFLAGS += ' -Wall'
32
+ $cc_is_gcc = true
33
+ else
34
+ STDOUT.print "no\n"
35
+ $cc_is_gcc = false
36
+ end
37
+
38
+ include_path = nil
39
+ if ENV['GTK_BASEPATH'] and /cygwin/ !~ RUBY_PLATFORM
40
+ include_path = (ENV['GTK_BASEPATH'] + "\\INCLUDE").gsub("\\", "/")
41
+ # $hdrdir += " -I#{include_path} "
42
+ $CFLAGS += " -I#{include_path} "
43
+ end
44
+
45
+ def check_win32()
46
+ $G_PLATFORM_WIN32 = false
47
+ $G_OS_WIN32 = false
48
+ $G_WITH_CYGWIN = false
49
+
50
+ STDOUT.print("checking for G_PLATFORM_WIN32... ")
51
+ STDOUT.flush
52
+ if macro_defined?('G_PLATFORM_WIN32', "#include <glibconfig.h>\n")
53
+ STDOUT.print "yes\n"
54
+ $G_PLATFORM_WIN32 = true
55
+ else
56
+ STDOUT.print "no\n"
57
+ end
58
+
59
+ if $G_PLATFORM_WIN32
60
+ STDOUT.print("checking for G_OS_WIN32... ")
61
+ STDOUT.flush
62
+ if macro_defined?('G_OS_WIN32', "#include <glibconfig.h>\n")
63
+ STDOUT.print "yes\n"
64
+ $G_OS_WIN32 = true
65
+ if $cc_is_gcc
66
+ if /^2\./ =~ `#{Config::CONFIG['CC']} -dumpversion`.chomp
67
+ $CFLAGS += ' -fnative-struct'
68
+ else
69
+ $CFLAGS += ' -mms-bitfields'
70
+ end
71
+ end
72
+ else
73
+ STDOUT.print "no\n"
74
+ end
75
+
76
+ # STDOUT.print("checking for G_WITH_CYGWIN... ")
77
+ # STDOUT.flush
78
+ # if macro_defined?('G_WITH_CYGWIN', "#include <glibconfig.h>\n")
79
+ # STDOUT.print "yes\n"
80
+ # $G_WITH_CYGWIN = true
81
+ # else
82
+ # STDOUT.print "no\n"
83
+ # end
84
+ end
85
+
86
+ nil
87
+ end
88
+
89
+ def set_output_lib(target_name)
90
+ if /cygwin|mingw/ =~ RUBY_PLATFORM
91
+ filename = "libruby-#{target_name}.a"
92
+ if RUBY_VERSION > "1.8.0"
93
+ $DLDFLAGS << ",--out-implib=#{filename}" if filename
94
+ elsif RUBY_VERSION > "1.8"
95
+ $DLDFLAGS.gsub!(/ -Wl,--out-implib=[^ ]+/, '')
96
+ $DLDFLAGS << " -Wl,--out-implib=#{filename}" if filename
97
+ else
98
+ $DLDFLAGS.gsub!(/ --output-lib\s+[^ ]+/, '')
99
+ $DLDFLAGS << " --output-lib #{filename}" if filename
100
+ end
101
+ elsif /mswin32/ =~ RUBY_PLATFORM
102
+ filename = "libruby-#{target_name}.lib"
103
+ $DLDFLAGS.gsub!(/ --output-lib\s+[^ ]+/, '')
104
+ $DLDFLAGS.gsub!(/ \/IMPLIB:[^ ]+/, '')
105
+ $DLDFLAGS << " /IMPLIB:#{filename}" if filename
106
+ end
107
+ end
108
+
109
+ def setup_win32(target_name)
110
+ check_win32
111
+ set_output_lib(target_name)
112
+ end
113
+
114
+ #add_depend_package("glib2", "glib/src", "/...../ruby-gnome2")
115
+ def add_depend_package(target_name, target_srcdir, top_srcdir)
116
+ [top_srcdir, $configure_args['--topdir']].each do |topdir|
117
+ topdir = File.expand_path(topdir)
118
+ if RUBY_VERSION < "1.8.5"
119
+ $CFLAGS = "-I#{File.join(topdir, target_srcdir)} #{$CFLAGS}"
120
+ else
121
+ $INCFLAGS = "-I#{File.join(topdir, target_srcdir)} #{$INCFLAGS}"
122
+ end
123
+
124
+ if /cygwin|mingw/ =~ RUBY_PLATFORM
125
+ $libs << " -lruby-#{target_name}"
126
+ $LDFLAGS << " -L#{topdir}/#{target_srcdir}"
127
+ elsif /mswin32/ =~ RUBY_PLATFORM
128
+ $DLDFLAGS << " /libpath:#{topdir}/#{target_srcdir}"
129
+ $libs << " libruby-#{target_name}.lib"
130
+ end
131
+ end
132
+ end
133
+
134
+ def add_distcleanfile(file)
135
+ $distcleanfiles ||= []
136
+ $distcleanfiles << file
137
+ end
138
+
139
+ def create_makefile_at_srcdir(pkg_name, srcdir, defs = nil)
140
+ base_dir = File.basename(Dir.pwd)
141
+ builddir = srcdir[(srcdir.rindex(base_dir) + base_dir.size + 1)..-1]
142
+ builddir ||= "."
143
+ FileUtils.mkdir_p(builddir)
144
+
145
+ Dir.chdir(builddir) do
146
+ yield if block_given?
147
+
148
+ $defs << defs if defs
149
+
150
+ pattern = "*.{#{SRC_EXT.join(',')}}"
151
+ srcs = Dir[File.join(srcdir, pattern)]
152
+ srcs |= Dir[File.join(".", pattern)]
153
+ $objs = srcs.collect do |src|
154
+ File.basename(src, ".*") + ".o"
155
+ end.flatten.uniq
156
+
157
+ create_makefile(pkg_name, srcdir)
158
+ end
159
+ end
160
+
161
+ def create_top_makefile(sub_dirs = ["src"])
162
+ mfile = File.open("Makefile", "w")
163
+ if /mswin32/ =~ RUBY_PLATFORM
164
+ mfile.print <<MSWIN32_END
165
+
166
+ all:
167
+ #{sub_dirs.map{|d| " @cd #{d}\n @nmake -nologo all\n @cd ..\n"}.join('')}
168
+ install:
169
+ #{sub_dirs.map{|d| " @cd #{d}\n @nmake -nologo install DESTDIR=$(DESTDIR)\n @cd ..\n"}.join('')}
170
+ site-install:
171
+ #{sub_dirs.map{|d| " @cd #{d}\n @nmake -nologo site-install DESTDIR=$(DESTDIR)\n @cd ..\n"}.join('')}
172
+ clean:
173
+ #{sub_dirs.map{|d| " @cd #{d}\n @nmake -nologo clean\n @cd ..\n"}.join('')} @if exist extconf.h del extconf.h
174
+ @if exist conftest.* del conftest.*
175
+ @if exist *.lib del *.lib
176
+ @if exist *~ del *~
177
+ @if exist mkmf.log del mkmf.log
178
+ MSWIN32_END
179
+ else
180
+ mfile.print <<END
181
+ all:
182
+ #{sub_dirs.map{|d| " @cd #{d}; make all\n"}.join('')}
183
+
184
+ install:
185
+ #{sub_dirs.map{|d| " @cd #{d}; make install\n"}.join('')}
186
+ site-install:
187
+ #{sub_dirs.map{|d| " @cd #{d}; make site-install\n"}.join('')}
188
+ clean:
189
+ #{sub_dirs.map{|d| " @cd #{d}; make clean\n"}.join('')}
190
+ distclean: clean
191
+ #{sub_dirs.map{|d| " @cd #{d}; make distclean\n"}.join('')}
192
+ @rm -f Makefile extconf.h conftest.*
193
+ @rm -f core *~ mkmf.log
194
+ END
195
+ end
196
+ mfile.close
197
+ end
198
+
199
+ # This is used for the library which doesn't support version info.
200
+ def make_version_header(app_name, pkgname, dir = "src")
201
+ version = PKGConfig.modversion(pkgname).split(/\./)
202
+ (0..2).each do |v|
203
+ version[v] = "0" unless version[v]
204
+ end
205
+ filename = "rb#{app_name.downcase}version.h"
206
+
207
+ puts "creating #{filename}"
208
+
209
+ add_distcleanfile(filename)
210
+
211
+ FileUtils.mkdir_p(dir)
212
+ out = File.open(File.join(dir, filename), "w")
213
+
214
+ out.print %Q[/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
215
+ /************************************************
216
+
217
+ #{filename} -
218
+
219
+ This file was generated by mkmf-gnome2.rb.
220
+
221
+ ************************************************/
222
+
223
+ #ifndef __RB#{app_name}_VERSION_H__
224
+ #define __RB#{app_name}_VERSION_H__
225
+
226
+ #define #{app_name}_MAJOR_VERSION (#{version[0]})
227
+ #define #{app_name}_MINOR_VERSION (#{version[1]})
228
+ #define #{app_name}_MICRO_VERSION (#{version[2]})
229
+
230
+ #define #{app_name}_CHECK_VERSION(major,minor,micro) \\
231
+ (#{app_name}_MAJOR_VERSION > (major) || \\
232
+ (#{app_name}_MAJOR_VERSION == (major) && #{app_name}_MINOR_VERSION > (minor)) || \\
233
+ (#{app_name}_MAJOR_VERSION == (major) && #{app_name}_MINOR_VERSION == (minor) && \\
234
+ #{app_name}_MICRO_VERSION >= (micro)))
235
+
236
+
237
+ #endif /* __RB#{app_name}_VERSION_H__ */
238
+ ]
239
+ out.close
240
+ end
241
+
242
+ def check_ruby_func
243
+ $CPPFLAGS << " -I$(sitearchdir) "
244
+
245
+ #Other options
246
+ have_func("rb_define_alloc_func") # for ruby-1.8
247
+ have_func("rb_block_proc") # for ruby-1.8
248
+
249
+ STDOUT.print("checking for new allocation framework... ") # for ruby-1.7
250
+ if Object.respond_to? :allocate
251
+ STDOUT.print "yes\n"
252
+ $defs << "-DHAVE_OBJECT_ALLOCATE"
253
+ else
254
+ STDOUT.print "no\n"
255
+ end
256
+
257
+ STDOUT.print("checking for attribute assignment... ") # for ruby-1.7
258
+ STDOUT.flush
259
+ if defined? try_compile and try_compile <<SRC
260
+ #include "ruby.h"
261
+ #include "node.h"
262
+ int node_attrasgn = (int)NODE_ATTRASGN;
263
+ SRC
264
+ STDOUT.print "yes\n"
265
+ $defs << "-DHAVE_NODE_ATTRASGN"
266
+ else
267
+ STDOUT.print "no\n"
268
+ end
269
+ end
270
+
271
+ def add_obj(name)
272
+ $objs << name unless $objs.index(name)
273
+ end
274
+
275
+ def glib_mkenums(prefix, files, g_type_prefix, include_files)
276
+ add_distcleanfile(prefix + ".h")
277
+ add_distcleanfile(prefix + ".c")
278
+ GLib::MkEnums.create(prefix, files, g_type_prefix, include_files)
279
+ end
280
+
281
+ check_ruby_func
282
+
283
+ if /mingw/ =~ RUBY_PLATFORM
284
+ $ruby.gsub!('\\', '/')
285
+ end
286
+