Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

New GTK3 example for UASM

Started by GoneFishing, December 25, 2017, 10:58:37 PM

Previous topic - Next topic


Hello all with GTK3 on Linux  :biggrin:

Here's my new GTK3 example. It demonstrates various modal and nonmodal dialogs.

Quoteuasm -elf64 ./dialogs.asm
Quotegcc ./dialogs.o -o ./dialogs `pkg-config --libs gtk+-3.0 gthread-2.0 gobject-2.0 gmodule-no-export-2.0`

Try it, please
Feedback is welcome.

- I use "Nimbus Mono L" font for label markup. If you don't have this font just replace it with "Ubuntu".   
-  as per documentation   gtk_image_new_from_file function never returns error . If it doesn't find specified image it just takes   picture "image not found". It doesn't work on my machine - app terminates with SEGFAULT
- notice LOCAL dummy:qword in activate PROC . Looks like the app crashes with SEGFAULT with odd number of LOCALS (one per line)


Example-0 is ASM equivalent of official  GTK Basics tutorial .
It's  "... a simple signal-based Gtk application. This program will create an empty 200 × 200 pixel window."


TO BE FIXED in Dialogs example:

- modal dialogs are growing in size when text view widget is scrolled  right / down

EDIT:  new version attached
Now you can keep track of text buffer char count via console output. I decided leave it as it is . You have full freedom to experiment with SPACE/ENTER/BACKSPACE keyboard buttons !


I don't think UASM is properly aligning the stack.

This the prologue from this function:
show_nonmodal_clicked  PROC button:GtkButton,   user_data:gpointer
                       LOCAL nonmodal:GtkWidget , vbox:GtkWidget, lbl2:GtkWidget, image:GtkWidget, contentArea:GtkWidget

   0x401d6e <show_nonmodal_clicked>:   push   %rbp
   0x401d6f <show_nonmodal_clicked+1>:   mov    %rsp,%rbp
   0x401d72 <show_nonmodal_clicked+4>:   sub    $0x28,%rsp

or with Intel syntax:
  0x401d6e <show_nonmodal_clicked>:   push   rbp
   0x401d6f <show_nonmodal_clicked+1>:   mov    rbp,rsp
   0x401d72 <show_nonmodal_clicked+4>:   sub    rsp,0x28


I'll get the sample setup and double check the stack alignments, I'm busy working on 2.46.6 update now anyway so if there is a stack alignment issue I will fix it for the  next update. :)


How many empty slots do you have in your Samples folder for GTK examples?


As many as you can make? :)

The more samples we have the better, make sure you put plenty of attributions in to yourself and we can add a mention in the documentations about contributors to the samples, I feel aw27 also has some valuable examples lying around that would be useful ;)


For now I think about one more  custom dialog example with markup and  GTK Builder example.