From 1981fb81861e492b91c911a05d46b54d2491b697 Mon Sep 17 00:00:00 2001 From: Anton Gorenko Date: Sun, 23 May 2010 16:08:14 +0600 Subject: [PATCH] clean up --- .../lowlevel/gstreamer/gstreamer.factor | 4 ++-- .../lowlevel/hello-world/hello-world.factor | 2 +- extra/gir/samples/lowlevel/lowlevel.factor | 17 ++++++-------- .../gir/samples/lowlevel/opengl/opengl.factor | 22 +++++++------------ 4 files changed, 18 insertions(+), 27 deletions(-) diff --git a/extra/gir/samples/lowlevel/gstreamer/gstreamer.factor b/extra/gir/samples/lowlevel/gstreamer/gstreamer.factor index c8a2c4e620..0127f48e6b 100644 --- a/extra/gir/samples/lowlevel/gstreamer/gstreamer.factor +++ b/extra/gir/samples/lowlevel/gstreamer/gstreamer.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2010 Anton Gorenko. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.c-types alien.strings fry byte-arrays +USING: alien.c-types alien.strings fry byte-arrays classes.struct io.encodings.utf8 kernel locals math prettyprint gst gst.ffi glib.ffi gobject.ffi gtk gtk.ffi ; IN: gir.samples.lowlevel.gstreamer @@ -12,7 +12,7 @@ CONSTANT: uri "http://tinyvid.tv/file/3gocxnjott7wr.ogg" f f gst_init "playbin" "player" [ utf8 string>alien ] bi@ gst_element_factory_make :> pipeline - GType gint64 [ heap-size ] bi@ 2 * + :> value + GValue :> value value G_TYPE_STRING g_value_init drop value uri utf8 string>alien g_value_set_string diff --git a/extra/gir/samples/lowlevel/hello-world/hello-world.factor b/extra/gir/samples/lowlevel/hello-world/hello-world.factor index 6f832167fe..a7068937d6 100644 --- a/extra/gir/samples/lowlevel/hello-world/hello-world.factor +++ b/extra/gir/samples/lowlevel/hello-world/hello-world.factor @@ -23,7 +23,7 @@ IN: gir.samples.lowlevel.hello-world frame label 120 110 gtk_fixed_put button "clicked" utf8 string>alien - [ nip "Hello! :)" utf8 string>alien gtk_label_set_text 1 ] GtkButton:clicked + [ nip "Hello! :)" utf8 string>alien gtk_label_set_text t ] GtkButton:clicked label f 0 g_signal_connect_data drop window ; diff --git a/extra/gir/samples/lowlevel/lowlevel.factor b/extra/gir/samples/lowlevel/lowlevel.factor index 98b8a1ceb6..a3b8201787 100644 --- a/extra/gir/samples/lowlevel/lowlevel.factor +++ b/extra/gir/samples/lowlevel/lowlevel.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2010 Anton Gorenko. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.c-types alien.strings byte-arrays +USING: alien.c-types alien.strings byte-arrays classes.struct gtk glib.ffi gobject.ffi gtk.ffi io.encodings.utf8 kernel literals locals make math prettyprint sequences specialized-arrays gir.samples.lowlevel.hello-world @@ -31,12 +31,12 @@ CONSTANT: samples { [ GTK_WIN_POS_CENTER gtk_window_set_position ] tri gtk_tree_view_new :> list - list 0 gtk_tree_view_set_headers_visible + list f gtk_tree_view_set_headers_visible gtk_cell_renderer_text_new :> renderer gtk_tree_view_column_new :> column column "Sample" utf8 string>alien gtk_tree_view_column_set_title - column renderer 1 gtk_tree_view_column_pack_start + column renderer t gtk_tree_view_column_pack_start column renderer "markup" utf8 string>alien 0 gtk_tree_view_column_add_attribute list column gtk_tree_view_append_column drop @@ -47,11 +47,8 @@ CONSTANT: samples { store g_object_unref - ! Временный фикс, нужно придумать что-то другое, так как нет - ! конструктора для создания GtkTreeIter - gint gpointer [ heap-size ] bi@ 3 * + :> iter - - GType gint64 [ heap-size ] bi@ 2 * + :> value + GtkTreeIter :> iter + GValue :> value value G_TYPE_STRING g_value_init drop samples [ first2 swap [ "" % % "\n" % % ] "" make @@ -66,8 +63,8 @@ CONSTANT: samples { list "row-activated" utf8 string>alien - [ list-on-row-activited ] GtkTreeView:row-activated dup . - f f 0 g_signal_connect_data . + [ list-on-row-activited ] GtkTreeView:row-activated + f f 0 g_signal_connect_data drop window "destroy" utf8 string>alien [ 2drop gtk_main_quit ] GtkObject:destroy diff --git a/extra/gir/samples/lowlevel/opengl/opengl.factor b/extra/gir/samples/lowlevel/opengl/opengl.factor index bf3dd06edf..284a8c342f 100644 --- a/extra/gir/samples/lowlevel/opengl/opengl.factor +++ b/extra/gir/samples/lowlevel/opengl/opengl.factor @@ -1,29 +1,27 @@ ! Copyright (C) 2010 Anton Gorenko. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.strings gtk gobject.ffi gtk.ffi gdk.gl gtk.gl gdk.gl.ffi +USING: alien.enums alien.strings gtk gobject.ffi gtk.ffi gdk.gl gtk.gl gdk.gl.ffi gtk.gl.ffi io.encodings.utf8 kernel locals math opengl.gl prettyprint ; IN: gir.samples.lowlevel.opengl -! Sample based on +! This sample based on ! http://code.valaide.org/content/simple-opengl-sample-using-gtkglext :: on-configure ( sender event user-data -- result ) sender gtk_widget_get_gl_context :> gl-context sender gtk_widget_get_gl_window :> gl-drawable - gl-drawable gl-context gdk_gl_drawable_gl_begin 1 = + gl-drawable gl-context gdk_gl_drawable_gl_begin dup [ 0 0 200 200 glViewport gl-drawable gdk_gl_drawable_gl_end - 1 - ] - [ 0 ] if ; + ] when ; :: on-expose ( sender event user-data -- result ) sender gtk_widget_get_gl_context :> gl-context sender gtk_widget_get_gl_window :> gl-drawable - gl-drawable gl-context gdk_gl_drawable_gl_begin 1 = + gl-drawable gl-context gdk_gl_drawable_gl_begin dup [ GL_COLOR_BUFFER_BIT glClear @@ -41,9 +39,7 @@ IN: gir.samples.lowlevel.opengl [ glFlush ] if gl-drawable gdk_gl_drawable_gl_end - 1 - ] - [ 0 ] if ; + ] when ; :: opengl-win ( -- window ) GTK_WINDOW_TOPLEVEL gtk_window_new :> window @@ -53,12 +49,10 @@ IN: gir.samples.lowlevel.opengl [ 200 200 gtk_window_set_default_size ] [ GTK_WIN_POS_CENTER gtk_window_set_position ] tri - ! window 1 gtk_container_set_reallocate_redraws - - GDK_GL_MODE_RGBA GDK_GL_MODE_DOUBLE bitor + GDK_GL_MODE_RGBA enum>number gdk_gl_config_new_by_mode :> gl-config - window gl-config f 1 GDK_GL_RGBA_TYPE + window gl-config f t GDK_GL_RGBA_TYPE enum>number gtk_widget_set_gl_capability drop window "configure-event" utf8 string>alien