comparison gtk3/dw.c @ 1528:5facb5380944

Added dw_main_quit() function for exiting the dw_main() loop. Also some cleanups added to dw_exit() on OS/2 and Windows. Changed OS/2 to no longer destroy the message queue when leaving dw_main()... it should be done in dw_exit().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 05 Jan 2012 15:45:11 +0000
parents 010e1d916ee7
children b7136c130a66
comparison
equal deleted inserted replaced
1527:9bab702bd6c1 1528:5facb5380944
1855 } 1855 }
1856 1856
1857 /* 1857 /*
1858 * Runs a message loop for Dynamic Windows. 1858 * Runs a message loop for Dynamic Windows.
1859 */ 1859 */
1860 void dw_main(void) 1860 void API dw_main(void)
1861 { 1861 {
1862 gdk_threads_enter(); 1862 gdk_threads_enter();
1863 _dw_thread = pthread_self(); 1863 _dw_thread = pthread_self();
1864 gtk_main(); 1864 gtk_main();
1865 _dw_thread = (pthread_t)-1; 1865 _dw_thread = (pthread_t)-1;
1866 gdk_threads_leave(); 1866 gdk_threads_leave();
1867 } 1867 }
1868 1868
1869 /* 1869 /*
1870 * Causes running dw_main() to return.
1871 */
1872 void API dw_main_quit(void)
1873 {
1874 gtk_main_quit();
1875 }
1876
1877 /*
1870 * Runs a message loop for Dynamic Windows, for a period of milliseconds. 1878 * Runs a message loop for Dynamic Windows, for a period of milliseconds.
1871 * Parameters: 1879 * Parameters:
1872 * milliseconds: Number of milliseconds to run the loop for. 1880 * milliseconds: Number of milliseconds to run the loop for.
1873 */ 1881 */
1874 void dw_main_sleep(int milliseconds) 1882 void API dw_main_sleep(int milliseconds)
1875 { 1883 {
1876 struct timeval tv, start; 1884 struct timeval tv, start;
1877 pthread_t curr = pthread_self(); 1885 pthread_t curr = pthread_self();
1878 1886
1879 gettimeofday(&start, NULL); 1887 gettimeofday(&start, NULL);
1919 } 1927 }
1920 1928
1921 /* 1929 /*
1922 * Processes a single message iteration and returns. 1930 * Processes a single message iteration and returns.
1923 */ 1931 */
1924 void dw_main_iteration(void) 1932 void API dw_main_iteration(void)
1925 { 1933 {
1926 pthread_t orig = _dw_thread; 1934 pthread_t orig = _dw_thread;
1927 pthread_t curr = pthread_self(); 1935 pthread_t curr = pthread_self();
1928 int _locked_by_me = FALSE; 1936 int _locked_by_me = FALSE;
1929 1937