[Solved] standalone Gtk dialog: how to keep it above other windows?

i'm building a zenity-like program ( http://bbs.archlinux.org/viewtopic.php?id=71453 )
For some reason my WM (wmii) always treats it as a "full window" unlike zenity which is a small popup.
I want to have it behave like zenity.  I studied the zenity source code but they use Glade which makes it hard to grasp.
i also made a test program to try out a variety of options, but all my attempts failed.
The attempts that need the root window failed because I couldn't figure out the correct way to get the root window. (apparently GDK_ROOT_PARENT(); does not work. I get glib assertion errors)
#include <gtk/gtk.h>
int main( int argc, char *argv[])
GtkWidget *window;
gtk_init(&argc, &argv);
GtkWidget * root = (GtkWidget *) GDK_ROOT_PARENT();
/* this is supposed to call gtk_window_set_type_hint() automatically
GtkWidget *dialog = gtk_dialog_new_with_buttons ("My dialog",
(GtkWindow *) root,
GTK_DIALOG_MODAL,
"title");
window = gtk_dialog_new();
gtk_window_set_transient_for ((GtkWindow *)window, (GtkWindow *)root);
gtk_window_set_keep_above ( (GtkWindow *) window, TRUE);
//gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DIALOG);
//gtk_window_set_title(GTK_WINDOW(window), "Center");
// gtk_window_set_default_size(GTK_WINDOW(window), 230, 150);
// gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_widget_show(window);
g_signal_connect_swapped(G_OBJECT(window), "destroy",
G_CALLBACK(gtk_main_quit), NULL);
gtk_main();
return 0;
Last edited by Dieter@be (2009-05-13 19:17:20)

a more complete example, also demonstrates how you can add your own stuff to the dialog
#include <gtk/gtk.h>
void on_response (GtkDialog *dialog, gint response, gpointer data);
int main(int argc, char **argv)
GtkWidget *dialog, *content, *label, *box, *image;
gtk_init(&argc, &argv);
dialog = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(dialog), "Center");
gtk_window_set_default_size(GTK_WINDOW(dialog), 230, 150);
gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE);
gtk_window_set_skip_pager_hint(GTK_WINDOW(dialog), TRUE);
gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), TRUE);
gtk_dialog_add_button(GTK_DIALOG(dialog), "title", GTK_RESPONSE_ACCEPT);
gtk_dialog_add_button(GTK_DIALOG(dialog), "(11) Ok", 11);
/* the vbox that holds the content_area */
content = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
box = gtk_hbox_new(FALSE, 0);
label = gtk_label_new("Hello, World!");
image = gtk_image_new_from_stock(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
gtk_container_add(GTK_CONTAINER(box), image);
gtk_container_add(GTK_CONTAINER(box), label);
gtk_container_add(GTK_CONTAINER(content), box);
/* emitted when the window is closed */
g_signal_connect(G_OBJECT(dialog), "delete-event", G_CALLBACK(gtk_main_quit), NULL);
/* emitted when a button is clicked */
g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(on_response), NULL);
gtk_widget_show_all(dialog);
gtk_main();
return 0;
void on_response (GtkDialog *dialog, gint response, gpointer data)
GtkWidget *label;
(void)data;
switch (response) {
case GTK_RESPONSE_ACCEPT:
/* what to do when this signal is received */
g_print("you clicked on title\n");
break;
case 11:
gtk_main_quit();
break;
Last edited by kumyco (2009-05-12 21:17:14)

Similar Messages

  • How to keep playing when Premiere window not on focus?

    I make home movies in Premiere, which means putting together a lot of spontaneous clips.
    Because of that, I must censor them on the editing table so that no disgusting, gossipy or insulting comment gets burned to a disc and sent to my relatives.
    Adobe Premiere stops playing as soon as any other window gains focus, which means that I am forced to watch the entire project (2 hours) even though I only want to listen to it, perhaps whilst I could be browsing the web, chatting, etc.
    Is there a way I can force Premiere to play the project while being in the background?
    Thank you.
    P.S. The same thing happens with Encore.

    function(){return A.apply(null,[this].concat($A(arguments)))}
    disgusting, gossipy or insulting comment 
    No wonder Premiere stops.
    Make sure your machine is up to date with all the latest drivers.

  • How to play .wma and other Windows Media Player-format files/videos on Mac?

    Hi again,
    I will be asking stupid questions as I'm a newbie to Mac, so please bear with me. There are some video format that QuickTime player doesn't play e.g. .wma files. I tried a couple of times to download Windows Media Player for Mac but it doesn't install on my Mac! Do I require a software similar to Zipfile or does Mac has it all build in?
    PS - What is the coequal of "delete" button here in Mac (keyboard)?

    Download and install Flip4Mac - VersionTracker or MacUpdate - to play Windows Media files via Quicktime. Also get Perian to provide additional codecs for other video formats.
    The Delete key is on the keyboard next to the "=" key.

  • How can we make 1 window to be displayed on top of other window in smartfor

    Dear friends,
                       How can we make 1 window to be displayed on top of other window in smartforms as i m not getting content of a window which is placed above other window?

    Hi,
    There r two ways ways to display image.
    1)As background image
    2)using graphic node.
    To display image as background.
    click on page node.
    choose background picture options
    enter the path of the image.enter the resolution and output mode in the output attributes.
    enter the horizontal and vertical positions where the image to be displayed in the page.
    To display image using Graphic node.
    Add a graphic node into the window where u want the image to be displayed.
    In the General attribute enter the path and the resolution.
    Hope ur problem get solved.
    Regards,
    shiva

  • Save as PDF dialog popping under all other windows using Acrobat 9

    One of my clients  recently upgraded a bunch of their workstations to Windows 7 64bit  Enterprise edition.  Now when they try to print to a PDF by selecting the print option in any application and then selecting the PDF printer, the dialog box pops  under all the other windows.  The result is the application appears to  freeze, as it is stuck at the 'now printing' screen.  See the below screenshot for a sample.  Meanwhile, the save as PDF dialog is still there and  if you click on the blank icon you can see in the attached screenshot,  the dialog will pop up and you can finish making the PDF.
    Steps  I've already taken to try to resolve this include: running a repair of  acrobat, uninstalling and reinstalling acrobat and removing and adding  the PDF printer.  So far none of this has had any effect.  I'm using the  current (that is 9.3.2) patch revision for acrobat.
    Any  help/suggestions would be most welcome!

    Are they really missing or there are place holders there? Have you gone to the preferences and turned on View Large Images? As an unrelated comment, do you really want images in a resume? Maybe if you are a graphic artist or such, but images are not common in most resumes I have seen and I would not expect such. However, that is really your choice, just wanted to comment.

  • How do I get rid of a dialog box that keeps coming back even though I press Cancel?

    How do I get rid of a dialog box that keeps coming back even though I press Cancel?

    I was looking up Olympic stats on  Norwegian website, and must have inadvertently clicked a link. The dialog box says: "There is no application set to open the URL nasjoner:2"
    It goes on to tell me to search the App Store , choose an application, or cancel.

  • How to keep songs on iphone, work computer and home computer the same?

    How to keep songs on iphone, work computer and home computer the same?
    This seems like something everyone would want to do. I don't know why Apple won't give us a simple solution. They could even charge us for it. I would pay!
    Has anyone solved this? What is your solution?
    Thanks!
    [email protected]

    If you just want to be able to sync your devices to the same PC without having them get overwritten all the times, here is a free method
    http://cnettv.cnet.com/sync-your-ipod-two-computers/9742-1_53-50004835.html
    Basically, you put the same itunes database file on all the PCs. This fakes itunes into thinking it is always the same PC and the ipod is OK to sync with it. It will NOT keep your libraries truly synced, though. I've just resigned myself to always buying from one PC and manually transferring the content to other PCs I want it on.

  • New portal preview, how to keep an altered query in a chart on the home screen?

    This one has been driving me nuts, here is the situation.... I pin a chart to the "Home" screen from the DefaulfServerFarm hosting plan for CPU, nice hero size, yeah!  I then clone it and then adjust the query to show memory
    on one of them.  Then I adjust the timeline in the queries for week on both to get an aggregate view of days, all good.  As soon as I refresh the portal...!?!?!...both charts are sitting at CPU current day, log out/in same behavior.  Probably
    something silly I'm doing/not doing, anyone have any thoughts or ideas on how to keep chart views in place?  Thanks in advance!
    Jeff

    Here is an example of what I would like to pin to the start, so that every time the preview portal is opened,  the last week's memory and cpu is viewed.  You can do this by adjusting the query on the chart, however the experience is that
    if you logout and log back into the portal you will see only the settings from the chart you copied, and not the updated queries.  Hope that makes sense.  Maybe there is a better way to accomplish this.  Thanks!
    Jeff
    Disclaimer: All dialog I post or respond to in online forums or social media is classified as personal interest, and is not affiliated in any way with my employer, unless specifically noted in the dialog.

  • How to keep the field open for input with error message in report program

    Hi,
      Need a help in solving the below issue.
    "How to keep the field open for input with error message in report program"
    Regards,
    C.Shasiraj.

    Hi...
    you have to use the event:
    <b>AT SELECTION-SCREEN ON <FIELD> EVENT.</b>
    u have to give an error message in this event.
    Consider the following <b>Example:</b>
    <b>PARAMETERS : NUMBER TYPE I.
    AT SELECTION-SCREEN ON NUMBER.
      IF NUMBER = 10.
        MESSAGE 'Number vakue is 10' TYPE 'E'.
      ENDIF.
    START-OF-SELECTION.
      WRITE NUMBER.
    </b>
    in this if u give the value of number = 10, it will not proceed further, if u give some other value other than 10 you will proceed further...
    Execute this program once u will understand....
    also Consider the following links :
    <b>Regarding events:</b>
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/79/34a237d9b511d1950e0000e8353423/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/79/34a23ad9b511d1950e0000e8353423/frameset.htm
    <b>Regarding messages:</b>
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/c5/aa575426ad11d2954d0000e8353423/frameset.htm
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/c5/aa575426ad11d2954d0000e8353423/frameset.htm
    This is very useful.......
    Reward points if useful....
    Suresh....

  • Windows 2012 R2 / Windows Essentials Role. How to keep from Changing DNS.

    So I have asked this question in the windows 2012 Server board and was directed to try it here in the essentials.
    that existing thread is here >>
    http://social.technet.microsoft.com/Forums/en-US/11cfbc1b-0001-42d6-85c1-304d1e450679/windows-2012-r2-windows-essentials-role-how-to-keep-from-changing-dns?forum=winserver8gen
    now to the question
    Ok so I will describe my problem as best as I can.
    I have 2 Servers Both 2012 R2 Standard 1 is Primary Domain controller and one is the Secondary Domain controller. I had everything set up on the domain and the Primary Domain controller was set up as the DNS on ALL clients (Static).
    Recently I set up the secondary domain controller with Essentials. All went well I added all the clients to connect with Essentials. a few days went by and now all of a sudden all the Static DNS's are all changed to the Essentials box.
    This Really wouldn't be a problem to me except the performance level of that DNS is EXTREAMLY slow. I run to all clients and change the static back and everything works great. then a little while goes by and all DNS's are again to the Essentials box.
    SO my question would be. Is there any way to configure the Essentials box to stop redirecting the DNS to itself and keep the Primary domain controller as the DNS

    Hi Curtis_bob,
    I noticed that Olaf had provided
    KB2862551 in the old thread. Just check if Olaf’s suggestion can help you to solve this issue.
    If this issue still exists, would you please let me confirm whether has also installed DNS server role on the
    Windows Server 2012 R2 Standard (with Windows Server Essentials Experience role)?
    If any update, please feel free to let us know.
    Best regards,
    Justin Gu

  • How to keep OI window in background with message box/pop up boxes on top.

    Hi
    I have a new requirement to add in OI .How to keep OI main window fixed in the background with message pop ups atop OI window.
    Even  with message box pop ups , i should not have the access to OI main window.To  make it more clear,when i change to some other application in my PC task bar (for eg:-MSWord) and then click back to OI main window ,i should see the message box on the top of OI main window . I should not  have the access to click OI main window and OI message box as two separate operation in the task bar.
    Please let me know where i need to make changes in my OI  codeset.
    Regards,
    Nand

    Hi Nand,
    In the Message Popup step settings, check Make Modal under Layout >> Dialog Options.  
    I hope this helps.
    Cheers,
    David Goldberg
    National Instruments
    Software R&D

  • How to keep the real data if number length bigger than 15 in excel format

    i have a bank card number column in report, the data type is varchar , and the data is always number , the length is bigger than 15, now if i download the report as excel format, this column's data will alwasys change to something like "5.41321E+17", and due to this, i just format this column to custom=0, but all data will change the last number to "0" like "460025198509180000", this is what i do not wanted.
    how to solve this problem? thanks in advance
    Kaymo
    Edited by: user10740102 on Jun 11, 2009 1:23 AM

    it's because Excel is thinking that it's a number....try changing the formula for the column from Table.ColumnName to the following
    '"'||Table.ColumnName||'"' (or use CONCAT - it's the same)
    This will show quotes and when you download to excel - it'll drop the quotes and keep the number

  • How to keep track of emails btn Blackberry & Outlook???

    Hi,
    I'm considering buying a Blackberry Curve (Sprint).  My hangup thus far is that I want to have all of my sent emails in my Outlook on my home computer.  My solution thus far has been to use GoToMyPC so that I can connect to my home PC from any computer and take care of my emails.  Also, I work mostly from home, so this isn't a huge problem in terms of convenience and efficiency. 
    Most people tell me that they CC themselves when they send an important email from their Blackberry.  This is how they keep track of important emails sent from their Blackberry.  IS THERE ANOTHER WAY?  A MORE RELIABLE WAY?  IS THERE A WAY TO HAVE ALL EMAILS SYNC'D WITH OUTLOOK WHEN (THEORETICALLY) SYNCING MY BLACKBERRY WITH MY HOME COMPUTER?  IF NOT, WHAT IS THE BEST WAY?
    Thanks in advance,
    Gary 
    Solved!
    Go to Solution.

    I have two (2) EMails addresses; on is my blackberry address, and the other is my Outlook.  I mostly give out my Outlook address so I could have it on my PC at home, and when Isync it is there,. Or, in the field if I inadvertantly delete a message, I know it will still  be on my PC at Home. I think your friend is correct. If she has the Blackberry
    Enterprise System through her IT Dept. at work. I have the BIS (Blackberry Internet Service).
    I hope this helps. It is quite confusing
    Writer~
    Thanks,
    Writer~

  • How to keep multiple function modules under one Web service

    Hi Experts,
    I have Three RFC function modules and i need to create one web service for these three RFC function modules. I know How to crearte a web service for one function module.
    please suggest me How to keep multiple function modules under one Web service.
    Thanks in advance
    Lakshminarayana

    Hi Lakshmi,
    The best way to do it is to assign all the three RFC Enabled FM's to one function group. Later on the top menu in Utilities you get an option to Create a Webservice from a Function Group.
    You can create one single Webservice using all the the 3 FM's.
    I hope this helps.
    Thanks,
    Manu

  • How to keep FI posting period (OB52) closed but keep CO posting periods (OK

    Hi SAP Guru's,
    how to keep FI posting period (OB52) closed but keep CO posting periods (OKP1) open.
    I.e. on Oct 21th the FI posting period 10 should be open but FI posting period 09 should be closed. But on Oct 21th the CO posting period 09 should be open.
    Thanks in Advance.
    RV

    You've already activeted. You can check in IMG-Financial Accounting Global Settings (New) ® Ledgers ® Real-Time Integration of Controlling with Financial Accounting
    Check this for more info http://help.sap.com/saphelp_dimp50/helpdata/en/22/c2cf4031288131e10000000a1550b0/content.htm

Maybe you are looking for

  • Report without Refresh

    Hi i want to generate a report without refresh of the page. Eg. If i enter the student_id 1 in text field then student_id 1's personal information should display in report without refresh of the page. there are 5 field in student table first name las

  • Datagrid colum item renderer HELP!!!!!

    Hi, I have the below datagrid, and I have to populate one of the column with three different images, a cricle an squeare and a triangle. I've been sucessful adding dinamically the differents itemrenderers. For the triangle one it has been a really pa

  • Keyboard won't come up when screen pressed where i want to type?

    keyboard won't come up when screen pressed where i want to type?

  • No sound from VM (Windows 7) on qemu with virt-manager

    I have installed Windows 7 (64bit) on qemu with virt-manager. It seems that audio works fine inside the guest os, but I can hear no sound. [Guest] Guest os: Windows 7 (64 bit) Sound driver: ich6 Console: Spice (VNC doesn't work.) [Host] linux 3.12.8-

  • HP 932 XL - new ink and blank pages

    My problem is quite complex - I am a new user of HP 6700. I bought the printer second-handed - it was relatively new though - only 700 pages printed. There were almost used setup inks inside. I printed a test page and it was alright. I figured that e